Spatial variation of local work function (LWF), which represents the surface potential, was examined for p-n junctions on a Si(111) substrate and for (110) cross sectional surfaces of boron-doped p-p + multi-layers (1E17 -5E19 /cm 3 ) grown on a (001) substrate. The LWF maps obtained by the vacuum-gap modulation scanning tunneling spectroscopy (VGM-STS) on oxygen-passivated atomically flat (111) terraces reveal the variation in carrier density across a p-n junction. Density of local fluctuations in LWF maps (i) decreases with increase of the bias voltage, and (ii) correlates well with the boron doping concentration, verifying their origin in local electrostatic fields around negative point charge centers and in particular, boron acceptors beneath the surface. The results demonstrate the ability of VGM-STS to measure both the surface potential and distribution of charge centers with a sub-nanometer resolution on oxidized Si surfaces.