Electrical control and readout of magnetic states is an important goal in spintronics. But electrical access to quantum spin systems comes at the cost of coupling to electrodes, which reduces the spin lifetimes through relaxation to electron–hole pairs. Here we report an electrically probed single-atom spin that is long-lived thanks to engineering the coupling of individual iron atoms to the nearby metallic electrodes. Using spin-polarized scanning tunnelling microscopy, we show that the excited spin state of these atoms persists for more than ten milliseconds. The lifetime can be tuned by varying the distance to the microscope probe tip—acting as one electrode—and by changing the thickness of the insulating film which separates the atom from the underlying electrode. The cross-section for spin-flip scattering is so small that many thousands of electrons can probe the spin state projectively before it relaxes. Using all-electrical pump–probe spectroscopy, we measure the lifetime of the atom for different tip–atom distances and determine the intrinsic lifetime as a function of the insulator thickness. We explain the tuning of the spin lifetime in terms of the conductance to each of the electrodes, which provides a method to maximize the electrical readout signal for a given lifetime.