To constrain the equation of state of cold dense matter, astrophysical measurements are essential. These are mostly based on observations of neutron stars in the X-ray band, and, more recently, also on gravitational wave observations. Of particular interest are observations of unusually heavy or light neutron stars which extend the range of central densities probed by observations and thus permit the testing of nuclear-physics predictions over a wider parameter space. Here we report on the analysis of such a star, a central compact object within the supernova remnant HESS J1731-347. We estimate the mass and radius of the neutron star to be \(M=0.7{7}_{-0.17}^{+0.20}\,{M}_{\odot }\) and \(R=10.{4}_{-0.78}^{+0.86}\) km, respectively, based on modelling of the X-ray spectrum and a robust distance estimate from Gaia observations. Our estimate implies that this object is either the lightest neutron star known, or a ‘strange star’ with a more exotic equation of state. Adopting a standard neutron star matter hypothesis allows the corresponding equations of state to be constrained.