The application of magnetic resonance (MR) spectroscopy at progressively smaller length scales may eventually permit chemical imaging of spins at the surfaces of materials and biological complexes. In particular, the negatively charged nitrogen-vacancy (NV-) centre in diamond has been exploited as an optical transducer for nanoscale nuclear magnetic resonance. However, the spectra of detected spins are generally broadened by their interaction with proximate paramagnetic NV- centres through coherent and incoherent mechanisms. Here we demonstrate a detection technique that can resolve the spectra of electron spins coupled to NV- centres, namely substitutional nitrogen (NS) and neutral nitrogen-vacancy (NV0) centres in diamond, through optically detected cross-relaxation. The hyperfine spectra of these spins are a unique chemical identifier, suggesting the possibility, in combination with recent results in diamonds harbouring shallow NV- implants, that the spectra of spins external to the diamond can be similarly detected.