A sharp point (5) is brought so close to the surface of a sample (4) to be investigated that the forces occurring between the atoms at the apex of the point (5) and those at the surface cause a spring-like cantilever (7) to deflect. The cantilever (7) forms one electrode of a tunneling microscope, the other electrode being a sharp tip (8). The deflection of the cantilever (7) provokes a variation of the tunnel current, and that variation is used to generate a correction signal which can be employed to control the distance between said point (5) and the sample (4), in order, for example, to maintain the force between them constant as the point (5) is scanned across the surface of the sample (4) by means of an xyz-drive (3). In certain modes of operation, either the sample (4) or the cantilever (7) may be excited to oscillate in z-direction. If the oscillation is at the resonance frequency of the cantilever (7), the resolution is enhanced.