Taking advantage of nuclear spins for electronic structure analysis, magnetic resonance imaging and quantum devices hinges on the knowledge and control of their surrounding electronic configuration. Up to now, nuclear spin properties of single adatoms could not be studied individually using scanning probe techniques. Here, we measure and control the hyperfine interaction of individual atoms on magnesium oxide (MgO) by using spin-polarized scanning tunneling microscopy in combination with electron spin resonance . Using atom manipulation to move single atoms we find that the hyperfine interaction strongly depends on the binding configuration of the atom as well as the proximity to other magnetic atoms. This allows the extraction of atom- and position-dependent information about the electronic ground state, the state mixing with neighboring atoms as well as properties of the nuclear spin. Thus, the hyperfine spectrum becomes a powerful probe of the chemical environment of individual atoms and nanostructures.