Kelvin probe force microscopy under ultrahigh vacuum conditions has been used to image the electronic structure of a Mo/CuGaSe2/CdS/ZnO thin film solar cell. Due to the high energy sensitivity together with a lateral resolution in the nanometer range we obtained detailed information about the various interfaces within the heterostructure. The absolute work function of the different materials was measured on a polished cross section. To obtain a flat and clean surface we optimized the sputtering process with Ar ions. The presence of an additional MoSe2 layer between the Mo backcontact and the CuGaSe2 absorber layer was observed. © 2002 American Institute of Physics.