The developments of novel spintronic materials and spin-based electronic devices are hot topics of current research in materials science and solid-state physics. Both research fields could profit tremendously from atomic-scale insight into magnetic properties and spin-dependent interactions at the atomic level. Based on the development of spin-polarized scanning tunneling microscopy (SP-STM), the novel method of single-atom magnetometry has recently been established. It allows the measurement of magnetization curves and the determination of magnetic moments on an atom-by-atom basis. While the sensitivity level of single-atom magnetometry is below one Bohr magneton, it can easily be combined with the atomic-resolution imaging and manipulation capabilities of conventional STM, thereby offering a novel approach toward a rational material design based on the knowledge of the atomic-level properties and interactions within the solid state. Moreover, an atom-by-atom design and realization of all-spin logic devices has recently been demonstrated based on the combined knowledge derived from surface physics, nanoscience, and magnetism.