Sediment-covered basalt on the flanks of mid-ocean ridges constitutes most of Earth’s oceanic crust, but the composition and metabolic function of its microbial ecosystem are largely unknown. By drilling into 3.5-million-year-old subseafloor basalt, we demonstrated the presence of methane- and sulfur-cycling microbes on the eastern flank of the Juan de Fuca Ridge. Depth horizons with functional genes indicative of methane-cycling and sulfate-reducing microorganisms are enriched in solid-phase sulfur and total organic carbon, host δ13C- and δ34S-isotopic values with a biological imprint, and show clear signs of microbial activity when incubated in the laboratory. Downcore changes in carbon and sulfur cycling show discrete geochemical intervals with chemoautotrophic δ13C signatures locally attenuated by heterotrophic metabolism.