  The stable operation of quantum computers will rely on error-correction, in
which single quantum bits of information are stored redundantly in the Hilbert
space of a larger system. Such encoded qubits are commonly based on arrays of
many physical qubits, but can also be realized using a single
higher-dimensional quantum system, such as a harmonic oscillator. A powerful
encoding is formed from a periodically spaced superposition of position
eigenstates. Various proposals have been made for realizing approximations to
such states, but these have thus far remained out of reach. Here, we
demonstrate such an encoded qubit using a superposition of displaced squeezed
states of the harmonic motion of a single trapped Calcium ion, controlling and
measuring the oscillator through coupling to an ancilliary internal-state
qubit. We prepare and reconstruct logical states with an average square
fidelity of $87.3 \pm 0.7 \%$, and demonstrate a universal logical single qubit
gate set which we analyze using process tomography. For Pauli gates we reach
process fidelities of $\approx 97\%$, while for continuous rotations we use
gate teleportation achieving fidelities of $\approx 89 \%$. The control
demonstrated opens a route for exploring continuous variable error-correction
as well as hybrid quantum information schemes using both discrete and
continuous variables. The code states also have direct applications in quantum
sensing, allowing simultaneous measurement of small displacements in both
position and momentum.
