Stromatolites or, more generally, microbialites, are organosedimentary structures formed under the influence of phylogenetically and functionally diverse microbial communities. Precambrian stromatolites constitute the oldest traces of life on Earth. Modern microbialites are often used as valuable analogs of those primordial ecosystems, such that studying the metabolic potential of these communities can help formulating hypotheses on how these structures form and can be preserved in the fossil record. Although better known in sparse marine locations, microbialites are relatively frequent in freshwater alkaline lakes. Here, we will present a comparative metagenomic analysis of microbialite samples collected along a depth gradient in Lake Alchichica (Mexico). The community structure inferred from single-copy gene family identification and long-contig (>10 kb) assignation, consistently with previous rRNA gene surveys, showed a wide prokaryotic diversity dominated by Alphaproteobacteria, Gammaproteobacteria, Cyanobacteria and Bacteroidetes, while eukaryotes were largely dominated by green algae or diatoms. Functional analyses revealed the importance of carbohydrate metabolism. Diagnostic metabolic genes revealed a remarkable involvement of Alphaproteobacteria in anoxygenic photosynthesis and sulfide oxidation, and Cyanobacteria in oxygenic photosynthesis and nitrogen fixation, whereas sulfate reduction appeared marginal. Comparative analyses suggested functional similarities among various microbial mat and microbialite metagenomes as compared with soil or oceans, but showed differences in microbial processes among microbialite types linked to local environmental conditions. Assembling lineage-specific genomes from these complex communities will be helpful to understand key metabolic activities involved in carbonate precipitation and microbialite formation.