Metal tips decorated with CO molecules have paved the way for an impressively high resolution in atomic force microscopy (AFM). Although Pauli repulsion and the associated CO tilting play a dominant role at short distances, experiments on polar and metallic systems show that electrostatic interactions are necessary to understand the complex contrast observed and its distance evolution. Attempts to describe those interactions in terms of a single electrostatic dipole replacing the tip have led to contradictory statements about its nature and strength. Here, we solve this puzzle with a comprehensive experimental and theoretical characterization of the AFM contrast on Cl vacancies. Our model, based on density functional theory (DFT) calculations, reproduces the complex evolution of the contrast between both the Na cation and Cl anion sites, and the positively charged vacancy as a function of tip height, and highlights the key contribution of electrostatic interactions for tip-sample distances larger than 500 pm. For smaller separations, Pauli repulsion and the associated CO tilting start to dominate the contrast. The electrostatic field of the CO-metal tip can be represented by the superposition of the fields from the metal tip and the CO molecule. The long-range behavior is defined by the metal tip that contributes the field of a dipole with its positive pole at the apex. At short-range, the CO exhibits an opposite field that prevails. The interplay of these fields, with opposite sign and rather different spatial extension, is crucial to describe the contrast evolution as a function of the tip height.