RX J0822−4300 is the central compact object associated with the Puppis A supernova remnant. Previous X-ray observations suggested RX J0822−4300 to be a young neutron star with a weak dipole field and a peculiar surface temperature distribution dominated by two antipodal spots with different temperatures and sizes. An emission line at 0.8 keV was also detected. We performed a very deep (130-ks) observation with XMM–Newton, which allowed us to study in detail the phase-resolved properties of RX J0822−4300. Our new data confirm the existence of a narrow spectral feature, best modelled as an emission line, only seen in the ‘soft’-phase interval – when the cooler region is best aligned to the line of sight. Surprisingly, comparison of our recent observations to the older ones yields evidence for a variation in the emission-line component, which can be modelled as a decrease in the central energy from ∼0.80 keV in 2001 to ∼0.73 keV in 2009–10. The line could be generated via cyclotron scattering of thermal photons in an optically-thin layer of gas, or, alternatively, it could originate in low-rate accretion by a debris disc. In any case, a variation in energy, pointing to a variation of the magnetic field in the line-emitting region, cannot be easily accounted for.