  The extremely rapid assembly of the earliest galaxies during the first
billion years of cosmic history is a major challenge for our understanding of
galaxy formation physics. The advent of JWST has exacerbated this issue by
confirming the existence of galaxies in significant numbers as early as the
first few hundred million years. Perhaps even more surprisingly, in some
galaxies, this initial highly efficient star formation rapidly shuts down, or
quenches, giving rise to massive quiescent galaxies as little as 1.5 billion
years after the Big Bang. However, due to their faintness and red colour, it
has proven extremely challenging to learn about these extreme quiescent
galaxies, or to confirm whether any exist at earlier times. Here we report the
spectroscopic confirmation of a massive quiescent galaxy, GS-9209, at redshift
$z=4.658$, just 1.25 billion years after the Big Bang, using JWST NIRSpec. From
these data we infer a stellar mass of $M_* = 3.8\pm0.2\times10^{10}\ M_\odot$,
which formed over a $\simeq200$ Myr period before this galaxy quenched its star
formation activity at $z=6.5^{+0.2}_{-0.5}$, when the Universe was $\simeq800$
million years old. Based on the presence of broad H$\alpha$ in the spectrum and
a high narrow-line [NII]/H$\alpha$ ratio, we infer the presence of an accreting
supermassive black hole, with a mass of $M_\bullet = 5\pm1\times10^{8}\
M_\odot$. This large black hole mass relative to the stellar mass suggests that
active galactic nucleus (AGN) feedback may have been responsible for quenching
this galaxy. GS-9209 is also extremely compact, with an effective radius,
$r_e=215\pm20$ parsecs. This galaxy is both a likely descendent of the
highest-redshift submillimetre galaxies and quasars, and a likely progenitor
for the dense, ancient cores of the most massive local galaxies.
