The detection of weak magnetic fields with high spatial resolution is an outstanding problem in diverse areas ranging from fundamental physics and material science to data storage and bio-imaging. Here we describe a new approach to magnetometry that takes advantage of recently developed techniques for coherent control of solid-state spin qubits. We experimentally demonstrate this novel magnetometer employing an individual electronic spin associated with a Nitrogen-Vacancy (NV) center in diamond. Using an ultra-pure diamond sample, we achieve shot-noise-limited detection of nanotesla magnetic fields at kHz frequencies after 100 seconds of averaging. In addition, we demonstrate
sensitivity for a diamond nanocrystal with a volume of (30 nm)3. This magnetic sensor provides an unprecedented combination of high sensitivity and spatial resolution – potentially allowing for the detection of a single nuclear spin's precession within one second.