Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript. Core flood and field tests have demonstrated that decreasing injection water salinity increases oil recovery from sandstone reservoirs. However, the microscopic mechanism behind the effect is still under debate. One hypothesis is that as salinity decreases, expansion of the electrical double layer decreases attraction between organic molecules and pore surfaces. We have developed a method that uses atomic force microscopy (AFM) in chemical force mapping (CFM) mode to explore the relationship between wettability and salinity. We functionalised AFM tips with alkanes and used them to represent tiny nonpolar oil droplets. In repeated measurements, we brought our “oil” close to the surface of sand grains taken from core plugs and we measured the adhesion between the tip and sample. Adhesion was constant in high salinity solutions but below a threshold of 5...