Experimental investigations of spin-polarized electron confinement in nanostructures by scanning tunneling microscopy (STM) and scanning tunneling spectroscopy (STS) are reviewed. To appreciate the experimental results on the electronic level, the physical basis of STM is elucidated with special emphasis on the correlation between differential conductance, as measured by STS, and the electron density of states, which is accessible in ab initio theory. Experimental procedures which allow one to extract the electron dispersion relation from energy-dependent and spatially resolved STM and STS studies of electron confinement are reviewed. The role of spin polarization in electron confinement is highlighted by both experimental and theoretical insights, which indicate variation of the spin polarization in sign and magnitude on the nanometer scale. This review provides compelling evidence for the necessity to include spatial-dependent spin-resolved electronic properties for an in-depth understanding and quantitative assessment of electron confinement in magnetic nanostructures and interaction between magnetic adatoms.