The parasitic nematode Ascaris lumbricoides infects one billion people worldwide. Its perienteric fluid contains an octameric haemoglobin that binds oxygen nearly 25,000 times more tightly than does human haemoglobin. Despite numerous investigations, the biological function of this molecule has remained elusive. The distal haem pocket contains a metal, oxygen and thiol, all of which are known to be reactive with nitric oxide. Here we show that Ascaris haemoglobin enzymatically consumes oxygen in a reaction driven by nitric oxide, thus keeping the perienteric fluid hypoxic. The mechanism of this reaction involves unprecedented chemistry of a haem group, a thiol and nitric oxide. We propose that Ascaris haemoglobin functions as a 'deoxygenase', using nitric oxide to detoxify oxygen. The structural and functional adaptations of Ascaris haemoglobin suggest that the molecular evolution of haemoglobin can be rationalized by its nitric oxide related functions.