Galaxy clusters are the most massive virialized structures in the Universe and are formed through the gravitational accretion of matter over cosmic time1. The discovery2 of an evolved galaxy cluster at redshift z = 2, corresponding to a look-back time of 10.4 billion years, provides an opportunity to study its properties. The galaxy cluster XLSSC 122 was originally detected as a faint, extended X-ray source in the XMM Large Scale Structure survey and was revealed to be coincident with a compact over-density of galaxies2 with photometric redshifts of 1.9 ± 0.2. Subsequent observations3 at millimetre wavelengths detected a Sunyaev–Zel’dovich decrement along the line of sight to XLSSC 122, thus confirming the existence of hot intracluster gas, while deep imaging spectroscopy from the European Space Agency’s X-ray Multi-Mirror Mission (XMM-Newton) revealed4 an extended, X-ray-bright gaseous atmosphere with a virial temperature of 60 million Kelvin, enriched with metals to the same extent as are local clusters. Here we report optical spectroscopic observations of XLSSC 122 and identify 37 member galaxies at a mean redshift of 1.98, corresponding to a look-back time of 10.4 billion years. We use photometry to determine a mean, dust-free stellar age of 2.98 billion years, indicating that star formation commenced in these galaxies at a mean redshift of 12, when the Universe was only 370 million years old. The full range of inferred formation redshifts, including the effects of dust, covers the interval from 7 to 13. These observations confirm that XLSSC 122 is a remarkably mature galaxy cluster with both evolved stellar populations in the member galaxies and a hot, metal-rich gas composing the intracluster medium.