Understanding and controlling decoherence in open quantum systems is of fundamental interest in science, whereas achieving long coherence times is critical for quantum information processing. Although great progress was made for individual systems, and electron spin resonance (ESR) of single spins with nanoscale resolution has been demonstrated, the understanding of decoherence in many complex solid-state quantum systems requires ultimately controlling the environment down to atomic scales, as potentially enabled by scanning probe microscopy with its atomic and molecular characterization and manipulation capabilities. Consequently, the recent implementation of ESR in scanning tunnelling microscopy represents a milestone towards this goal and was quickly followed by the demonstration of coherent oscillations and access to nuclear spins with real-space atomic resolution. Atomic manipulation even fuelled the ambition to realize the first artificial atomic-scale quantum devices. However, the current-based sensing inherent to this method limits coherence times. Here we demonstrate pump–probe ESR atomic force microscopy (AFM) detection of electron spin transitions between non-equilibrium triplet states of individual pentacene molecules. Spectra of these transitions exhibit sub-nanoelectronvolt spectral resolution, allowing local discrimination of molecules that only differ in their isotopic configuration. Furthermore, the electron spins can be coherently manipulated over tens of microseconds. We anticipate that single-molecule ESR-AFM can be combined with atomic manipulation and characterization and thereby paves the way to learn about the atomistic origins of decoherence in atomically well-defined quantum elements and for fundamental quantum-sensing experiments.