A measurement of the mass difference between the top and the antitop quark (Delta m(t) = m(t) - m((t) over bar)) is performed using events with a muon or an electron and at least four jets in the final state. The analysis is based on data collected by the CMS experiment at the LHC, corresponding to an integrated luminosity of 4.96 +/- 0.11 fb(-1), and yields the value of Delta m(t) = -0.44 +/- 0.46 (stat.) +/- 0.27 (syst.) GeV. This result is consistent with equality of particle and antiparticle masses required by CPT invariance, and provides a significantly improved precision relative to existing measurements.