Correction to Bigmouth_Strikes
The sample does not have to be metallic, it simply has to be a reasonably good conductor, like a doped semiconductor.
Scanning tunnelling spectroscopy is a technique where the bias voltage of the STM is altered while the position of the tip is held constant. At different potentials, the electron density of states (and therefore the tunnelling current) may be different due to the allowed energy states of the sample material. Given this information, electronic properties of the material can be deduced, and some idea of the sample's composition can be formulated.