Magnetic resonance imaging and optical microscopy are key technologies in the life sciences. For microbiological studies, especially of the inner workings of single cells, optical microscopy is normally used because it easily achieves resolution close to the optical wavelength. But in conventional microscopy, diffraction limits the resolution to about half the wavelength. Recently, it was shown that this limit can be partly overcome by nonlinear imaging techniques, but there is still a barrier to reaching the molecular scale. In contrast, in magnetic resonance imaging the spatial resolution is not determined by diffraction; rather, it is limited by magnetic field sensitivity, and so can in principle go well below the optical wavelength. The sensitivity of magnetic resonance imaging has recently been improved enough to image single cells, and magnetic resonance force microscopy has succeeded in detecting single electrons and small nuclear spin ensembles. However, this technique currently requires cryogenic temperatures, which limit most potential biological applications. Alternatively, single-electron spin states can be detected optically, even at room temperature in some systems. Here we show how magneto-optical spin detection can be used to determine the location of a spin associated with a single nitrogen-vacancy centre in diamond with nanometre resolution under ambient conditions. By placing these nitrogen-vacancy spins in functionalized diamond nanocrystals, biologically specific magnetofluorescent spin markers can be produced. Significantly, we show that this nanometre-scale resolution can be achieved without any probes located closer than typical cell dimensions. Furthermore, we demonstrate the use of a single diamond spin as a scanning probe magnetometer to map nanoscale magnetic field variations. The potential impact of single-spin imaging at room temperature is far-reaching. It could lead to the capability to probe biologically relevant spins in living cells.