Quantum metrology1 uses tools from quantum information science to improve measurement signal-to-noise ratios. The challenge is to increase sensitivity while reducing susceptibility to noise, tasks that are often in conflict. Lock-in measurement is a detection scheme designed to overcome this difficulty by spectrally separating signal from noise. Here we report on the implementation of a quantum analogue to the classical lock-in amplifier. All the lock-in operations—modulation, detection and mixing—are performed through the application of non-commuting quantum operators to the electronic spin state of a single, trapped Sr+ ion. We significantly increase its sensitivity to external fields while extending phase coherence by three orders of magnitude, to more than one second. Using this technique, we measure frequency shifts with a sensitivity of 0.42 Hz Hz−1/2 (corresponding to a magnetic field measurement sensitivity of 15 pT Hz−1/2), obtaining an uncertainty of less than 10 mHz (350 fT) after 3,720 seconds of averaging. These sensitivities are limited by quantum projection noise and improve on other single-spin probe technologies2, 3 by two orders of magnitude. Our reported sensitivity is sufficient for the measurement of parity non-conservation4, as well as the detection of the magnetic field of a single electronic spin one micrometre from an ion detector with nanometre resolution. As a first application, we perform light shift spectroscopy of a narrow optical quadrupole transition. Finally, we emphasize that the quantum lock-in technique is generic and can potentially enhance the sensitivity of any quantum sensor.