Only three biological pathways are known to produce oxygen: photosynthesis, chlorate respiration and the detoxification of reactive oxygen species. Here we present evidence for a fourth pathway, possibly of considerable geochemical and evolutionary importance. The pathway was discovered after metagenomic sequencing of an enrichment culture that couples anaerobic oxidation of methane with the reduction of nitrite to dinitrogen. The complete genome of the dominant bacterium, named ‘Candidatus Methylomirabilis oxyfera’, was assembled. This apparently anaerobic, denitrifying bacterium encoded, transcribed and expressed the well-established aerobic pathway for methane oxidation, whereas it lacked known genes for dinitrogen production. Subsequent isotopic labelling indicated that ‘M. oxyfera’ bypassed the denitrification intermediate nitrous oxide by the conversion of two nitric oxide molecules to dinitrogen and oxygen, which was used to oxidize methane. These results extend our understanding of hydrocarbon degradation under anoxic conditions and explain the biochemical mechanism of a poorly understood freshwater methane sink. Because nitrogen oxides were already present on early Earth, our finding opens up the possibility that oxygen was available to microbial metabolism before the evolution of oxygenic photosynthesis. A previously unknown pathway producing oxygen during anaerobic methane oxidation linked to nitrite and nitrate reduction has been found in microbes isolated from freshwater sediments in Dutch drainage ditches. The complete genome of the bacterium responsible for this reaction has been assembled, and found to contain genes for aerobic methane oxidation. The bacterium reduces nitrite via the recombination of two molecules of nitric oxide into nitrogen and oxygen, bypassing the familiar denitrification intermediate nitrous oxide. This discovery is relevant to nitrogen and methane cycling in the environment and, since nitrogen oxides arose early on Earth, raises the possibility that oxygen was available to microbes before the advent of oxygen-producing photosynthesis. In certain microbes, the anaerobic oxidation of methane can be linked to the reduction of nitrates and nitrites. Here it is shown that this occurs through the intermediate production of oxygen. This brings the number of known biological pathways for oxygen production to four, with implications for our understanding of life on the early Earth.