The conditions of methane (CH4) formation in olivine-hosted secondary fluid inclusions and their prevalence in peridotite and gabbroic rocks from a wide range of geological settings were assessed using confocal Raman spectroscopy, optical and scanning electron microscopy, electron microprobe analysis, and thermodynamic modeling. Detailed examination of 160 samples from ultraslow- to fast-spreading midocean ridges, subduction zones, and ophiolites revealed that hydrogen (H2) and CH4 formation linked to serpentinization within olivine-hosted secondary fluid inclusions is a widespread process. Fluid inclusion contents are dominated by serpentine, brucite, and magnetite, as well as CH4(g) and H2(g) in varying proportions, consistent with serpentinization under strongly reducing, closed-system conditions. Thermodynamic constraints indicate that aqueous fluids entering the upper mantle or lower oceanic crust are trapped in olivine as secondary fluid inclusions at temperatures higher than ∼400 °C. When temperatures decrease below ∼340 °C, serpentinization of olivine lining the walls of the fluid inclusions leads to a near-quantitative consumption of trapped liquid H2O. The generation of molecular H2 through precipitation of Fe(III)-rich daughter minerals results in conditions that are conducive to the reduction of inorganic carbon and the formation of CH4. Once formed, CH4(g) and H2(g) can be stored over geological timescales until extracted by dissolution or fracturing of the olivine host. Fluid inclusions represent a widespread and significant source of abiotic CH4 and H2 in submarine and subaerial vent systems on Earth, and possibly elsewhere in the solar system.