Despite decades of advances in magnetic imaging, obtaining direct, quantitative information with nanometre scale spatial resolution remains an outstanding challenge. Recently, a technique has emerged that employs a single nitrogen-vacancy defect in diamond as an atomicsize magnetometer, which promises significant advances. However, the effectiveness of the technique when applied to magnetic nanostructures remains to be demonstrated. Here we use a scanning nitrogen-vacancy magnetometer to image a magnetic vortex, which is one of the most iconic objects of nanomagnetism, owing to the small size (B10 nm) of the vortex core. We report three-dimensional, vectorial and quantitative measurements of the stray magnetic field emitted by a vortex in a ferromagnetic square dot, including the detection of the vortex core. We find excellent agreement with micromagnetic simulations, both for regular vortex structures and for higher-order magnetization states. These experiments establish scanning nitrogen-vacancy magnetometry as a practical and unique tool for fundamental studies in nanomagnetism.