We present a microscopic surface photovoltage spectroscopy method. It is based on a tunable illumination system combined with a kelvin probe force microscope, which measures the contact potential difference between a sample surface and a tip of an atomic force microscope. By measuring the contact potential difference as a function of illumination wavelength, the whole surface photovoltage spectrum of a semiconductor sample is obtained with submicrometer spatial resolution. This resolution can be as high as 100 nm, in regions where the minority carrier transport is controlled by drift rather than by diffusion.