An individual magnetic atom doped into a semiconductor is a promising building block for bottom-up spintronic devices and quantum logic gates. Moreover, it provides a perfect model system for the atomic-scale investigation of fundamental effects such as magnetism in dilute magnetic semiconductors. However, dopants in semiconductors so far have not been studied by magnetically sensitive techniques with atomic resolution that correlate the atomic structure with the dopant's magnetism. Here we show electrical excitation and read-out of a spin associated with a single magnetic dopant in a semiconductor host. We use spin-resolved scanning tunnelling spectroscopy to measure the spin excitations and the magnetization curve of individual iron surface-dopants embedded within a two-dimensional electron gas confined to an indium antimonide (110) surface. The dopants act like isolated quantum spins the states of which are governed by a substantial magnetic anisotropy that forces the spin to lie in the surface plane. This result is corroborated by our first principles calculations. The demonstrated methodology opens new routes for the investigation of sample systems that are more widely studied in the field of spintronics-that is, Mn in GaAs (ref. 5), magnetic ions in semiconductor quantum dots, nitrogen-vacancy centres in diamond and phosphorus spins in silicon.