The operation of universal quantum computers is easily derailed by noise that modifies the state of physical qubits, causing logical errors. Fortunately, such errors can be detected and corrected if quantum information is encoded non-locally. Applying this idea to the hardware efficient bosonic codes, Gottesman Kitaev and Preskill proposed to encode a protected qubit into states forming grids in the phase-space of a harmonic oscillator. In our experiment , we prepare and stabilize such a qubit using repeated applications of a novel gate sequence on a superconducting microwave cavity. We demonstrate an unprecedented suppression of all logical errors, in quantitative agreement with a theoretical estimate based on the measured imperfections of the experiment. Our results are applicable to other continuous variable systems and, in contrast with previous implementations of quantum error correction, can mitigate the impact of a wide variety of noise processes and open a way towards fault-tolerant quantum computation.