We report on the analysis of a deep (100-ks) observation of the starburst galaxy M82 with the EPIC and RGS instruments onboard the X-ray telescope XMM–Newton. The broad-band (0.5–10 keV) emission is due to at least three spectral components: (i) continuum emission from point sources; (ii) thermal plasma emission from hot gas; and (iii) charge-exchange emission from neutral metals (Mg and Si). The plasma emission has a double-peaked differential emission measure, with the peaks at ∼0.5 and ∼7 keV. Spatially resolved spectroscopy has shown that the chemical absolute abundances are not uniformly distributed in the outflow, but are larger in the outskirts and smaller close to the galaxy centre. The abundance ratios also show spatial variations. The X-ray-derived oxygen abundance is lower than that measured in the atmospheres of red supergiant stars, leading to the hypothesis that a significant fraction of oxygen ions have already cooled off and no longer emit at energies ≳0.5 keV.