Many advances in polymers and layered materials rely on a precise understanding of the local interactions between adjacent molecular or atomic layers. Quantifying dispersion forces at the nanoscale is particularly challenging with existing methods often time consuming, destructive, relying on surface averaging or requiring bespoke equipment. Here, we present a non-invasive method able to quantify the local mechanical and dispersion properties of a given sample with nanometer lateral precision. The method, based on atomic force microscopy (AFM), uses the frequency shift of a vibrating AFM cantilever in combination with established contact mechanics models to simultaneously derive the Hamaker constant and the effective Young’s modulus at a given sample location. The derived Hamaker constant and Young’s modulus represent an average over a small (typically <100) number of molecules or atoms. The oscillation amplitude of the vibrating AFM probe is used to select the length-scale of the features to analyse, with small vibrations able to resolve the contribution of sub-nanometric defects and large ones exploring effectively homogeneous areas. The accuracy of the method is validated on a range of 2D materials in air and water as well as on polymer thin films. We also provide the first experimental measurements of the Hamaker constant of HBN, MoT2, WSe2 and polymer films, verifying theoretical predictions and computer simulations. The simplicity and robustness of the method, implemented with a commercial AFM, may support a broad range of technological applications in the growing field of polymers and nanostructured materials where a fine control of the van der Waals interactions is crucial to tune their properties.