  The ambition of harnessing the quantum for computation is at odds with the
fundamental phenomenon of decoherence. The purpose of quantum error correction
(QEC) is to counteract the natural tendency of a complex system to decohere.
This cooperative process, which requires participation of multiple quantum and
classical components, creates a special type of dissipation that removes the
entropy caused by the errors faster than the rate at which these errors corrupt
the stored quantum information. Previous experimental attempts to engineer such
a process faced an excessive generation of errors that overwhelmed the
error-correcting capability of the process itself. Whether it is practically
possible to utilize QEC for extending quantum coherence thus remains an open
question. We answer it by demonstrating a fully stabilized and error-corrected
logical qubit whose quantum coherence is significantly longer than that of all
the imperfect quantum components involved in the QEC process, beating the best
of them with a coherence gain of $G = 2.27 \pm 0.07$. We achieve this
performance by combining innovations in several domains including the
fabrication of superconducting quantum circuits and model-free reinforcement
learning.
