Nuclear magnetic resonance (NMR) is a powerful method for determining the structure of molecules and proteins1. Whereas conventional NMR requires averaging over large ensembles, recent progress with single-spin quantum sensors2–9 has created the prospect of magnetic imaging of individual molecules10–13. As an initial step towards this goal, isolated nuclear spins and spin pairs have been mapped14–21. However, large clusters of interacting spins—such as those found in molecules—result in highly complex spectra. Imaging these complex systems is challenging because it requires high spectral resolution and efficient spatial reconstruction with sub-ångström precision. Here we realize such atomic-scale imaging using a single nitrogen vacancy centre as a quantum sensor, and demonstrate it on a model system of 27 coupled 13C nuclear spins in diamond. We present a multidimensional spectroscopy method that isolates individual nuclear–nuclear spin interactions with high spectral resolution (less than 80 millihertz) and high accuracy (2 millihertz). We show that these interactions encode the composition and inter-connectivity of the cluster, and develop methods to extract the three-dimensional structure of the cluster with sub-ångström resolution. Our results demonstrate a key capability towards magnetic imaging of individual molecules and other complex spin systems9–13.