A novel technique is developed to follow the energetic position of the conduction and valence bands with respect to the Fermi level as a function of the lateral position on semiconductor surfaces. By combining high-resolution scanning-tunneling spectroscopy measurements with model calculations it is possible to relate the apparent change in conduction and valence band position to their real counterparts. This method allows one to determine the charge on surface artifacts like steps or vacancies, For a single step on p-type GaAs we find a charge of 0.9+/-0.3q nm(-1). (C) 2002 Elsevier Science B.V. All rights reserved.