Viruses are the most abundant biological entities throughout marine and terrestrial ecosystems, but little is known about virus-mineral interactions or the potential for virus preservation in the geological record. Here we use contextual metagenomic data and microscopic analyses to show that viruses occur in high diversity within a modern lacustrine microbial mat, and vastly outnumber prokaryotes and other components of the microbial mat. Experimental data reveal that mineral precipitation takes place directly on free viruses and, as a result of viral infections, on cell debris resulting from cell lysis. Viruses are initially permineralized by amorphous magnesium silicates, which then alter to magnesium carbonate nanospheres of ∼80-200 nm in diameter during diagenesis. Our findings open up the possibility to investigate the evolution and geological history of viruses and their role in organomineralization, as well as providing an alternative explanation for enigmatic carbonate nanospheres previously observed in the geological record.