Magnetic resonance imaging, with its ability to provide three-dimensional, elementally selective imaging without radiation damage, has had a revolutionary impact in many fields, especially medicine and the neurosciences. Although challenging, its extension to the nanometre scale could provide a powerful new tool for the nanosciences, especially if it can provide a means for non-destructively visualizing the full three-dimensional morphology of complex nanostructures, including biomolecules1. To achieve this potential, innovative new detection strategies are required to overcome the severe sensitivity limitations of conventional inductive detection techniques2. One successful example is magnetic resonance force microscopy3, 4, which has demonstrated three-dimensional imaging of proton NMR with resolution on the order of 10 nm, but with the requirement of operating at cryogenic temperatures5, 6. Nitrogen–vacancy (NV) centres in diamond offer an alternative detection strategy for nanoscale magnetic resonance imaging that is operable at room temperature7. Here, we demonstrate two-dimensional imaging of 1H NMR from a polymer test sample using a single NV centre in diamond as the sensor. The NV centre detects the oscillating magnetic field from precessing protons as the sample is scanned past the NV centre. A spatial resolution of ∼12 nm is shown, limited primarily by the scan resolution.