  Quantum systems can be used to measure various quantities in their
environment with high precision. Often, however, their sensitivity is limited
by the decohering effects of this same environment. Dynamical decoupling
schemes are widely used to filter environmental noise from signals, but their
performance is limited by the spectral properties of the signal and noise at
hand. Quantum error correction schemes have therefore emerged as a
complementary technique without the same limitations. To date, however, they
have failed to correct the dominant noise type in many quantum sensors, which
couples to each qubit in a sensor in the same way as the signal. Here we show
how quantum error correction can correct for such noise, which dynamical
decoupling can only partially address. Whereas dynamical decoupling exploits
temporal noise correlations in signal and noise, our scheme exploits spatial
correlations. We give explicit examples in small quantum devices and
demonstrate a method by which error-correcting codes can be tailored to their
noise.
