According to the CPT theorem, which states that the combined operation of charge conjugation, parity transformation and time reversal must be conserved, particles and their antiparticles should have the same mass and lifetime but opposite charge and magnetic moment. Here, we test CPT symmetry in a nucleus containing a strange quark, more specifically in the hypertriton. This hypernucleus is the lightest one yet discovered and consists of a proton, a neutron and a Λ hyperon. With data recorded by the STAR detector1,2,3 at the Relativistic Heavy Ion Collider, we measure the Λ hyperon binding energy BΛ for the hypertriton, and find that it differs from the widely used value4 and from predictions5,6,7,8, where the hypertriton is treated as a weakly bound system. Our results place stringent constraints on the hyperon–nucleon interaction9,10 and have implications for understanding neutron star interiors, where strange matter may be present11. A precise comparison of the masses of the hypertriton and the antihypertriton allows us to test CPT symmetry in a nucleus with strangeness, and we observe no deviation from the expected exact symmetry.