The advent of oxygenic photosynthesis on Earth may have increased global biological productivity by a factor of 100-1,000 (ref. 1), profoundly affecting both geochemical and biological evolution. Much of this new productivity probably occurred in microbial mats, which incorporate a range of photosynthetic and anaerobic microorganisms in extremely close physical proximity. The potential contribution of these systems to global biogeochemical change would have depended on the nature of the interactions among these mat microorganisms. Here we report that in modern, cyanobacteria-dominated mats from hypersaline environments in Guerrero Negro, Mexico, photosynthetic microorganisms generate H2 and CO-gases that provide a basis for direct chemical interactions with neighbouring chemotrophic and heterotrophic microbes. We also observe an unexpected flux of CH4, which is probably related to H2-based alteration of the redox potential within the mats. These fluxes would have been most important during the nearly 2-billion-year period during which photosynthetic mats contributed substantially to biological productivity-and hence, to biogeochemistry-on Earth. In particular, the large fluxes of H2 that we observe could, with subsequent escape to space, represent a potentially important mechanism for oxidation of the primitive oceans and atmosphere.