Hydrogen is commonly produced during the high-temperature hydration of mafic and ultramafic rocks, owing to the oxidation of reduced iron present in the minerals. Hydrothermal hydrogen is known to sustain microbial communities in submarine vent and terrestrial hot-spring systems. However, the rates and mechanisms of hydrogen generation below temperatures of 150 °C are poorly constrained. As such, the existence and extent of hydrogen-fuelled ecosystems in subsurface terrestrial and oceanic aquifers has remained uncertain. Here, we report results from laboratory experiments in which we reacted ground ultramafic and mafic rocks and minerals—specifically peridotite, pyroxene, olivine and magnetite—with anoxic fluids at 55 and 100 °C, and monitored hydrogen gas production. We used synchrotron-based micro-X-ray fluorescence and X-ray absorption near-edge structure spectroscopy to identify changes in the speciation of iron in the materials. We report a strong correlation between molecular hydrogen generation and the presence of spinel phases—oxide minerals with the general formula [M2+M23+]O4 and a cubic crystal structure—in the reactants. We also identify Fe(III)-(hydr)oxide reaction products localized on the surface of the spinel phases, indicative of iron oxidation. We propose that the transfer of electrons between Fe(II) and water adsorbed to the spinel surfaces promotes molecular hydrogen generation at low temperatures. We suggest that these localized sites of hydrogen generation in ultramafic aquifers in the oceanic and terrestrial crust could support hydrogen-based microbial life.