Genome sequences of two Synechococcus ecotypes inhabiting the Octopus Spring microbial mat in Yellowstone National Park revealed the presence of all genes required for nitrogenase biosynthesis. We demonstrate that nif genes of the Synechococcus ecotypes are expressed in situ in a region of the mat that varies in temperature from 53.5 degrees C to 63.4 degrees C (average 60 degrees C); transcripts are only detected at the end of the day when the mat becomes anoxic. Nitrogenase activity in mat samples was also detected in the evening. Hitherto, N2 fixation in hot spring mats was attributed either to filamentous cyanobacteria (not present at >50 degrees C in these mats) or to heterotrophic bacteria. To explore how energy-generating processes of the Synechococcus ecotypes track natural light and O2 conditions, we evaluated accumulation of transcripts encoding proteins involved in photosynthesis, respiration, and fermentation. Transcripts from photosynthesis (cpcF, cpcE, psaB, and psbB) and respiration (coxA and cydA) genes declined in the evening. In contrast, transcripts encoding enzymes that may participate in fermentation fell into two categories; some (ldh, pdhB, ald, and ackA) decreased in the evening, whereas others (pflB, pflA, adhE, and acs) increased at the end of the day and remained high into the night. Energy required for N2 fixation during the night may be derived from fermentation pathways that become prominent as the mat becomes anoxic. In a broader context, our data suggest that there are critical regulatory switches in situ that are linked to the diel cycle and that these switches alter many metabolic processes within the microbial mat.