We use atomic force microscopy (AFM) to determine electrostatic interactions between Si tips and Si wafers in aqueous electrolytes of variable composition. We demonstrate that dynamic force spectroscopy (DFS) in the frequency modulation (FM) mode with stiff cantilevers and sharp tips allows for a continuous detection of the tip–sample interactions without mechanical jump-to-contact instability and with substantially higher lateral resolution than standard colloidal probe measurements. For four different species of salt (NaCl, KCl, MgCl2, CaCl2) we find repulsive electrostatic forces at the lowest salt concentrations (1 mM) that become progressively screened until they are dominated by attractive van der Waals forces at the highest concentration (100 mM). For the divalent cations the crossover from repulsive to attractive forces occurs at lower concentrations than for monovalent cations. Surface charges extracted from fits to standard Poisson–Boltzmann double layer theory indicate a rather weak dependence of the surface charge on the ion concentration. The high lateral resolution of our approach is illustrated by a 2D force field measurement over a patterned surface of a supported lipid bilayer on a mica substrate.