The magnetic fields generated by spins and currents provide a unique window into the physics of correlated-electron materials and devices. First proposed only a decade ago, magnetometry based on the electron spin of nitrogen-vacancy (NV) defects in diamond is emerging as a platform that is excellently suited for probing condensed matter systems; it can be operated from cryogenic temperatures to above room temperature, has a dynamic range spanning from direct current to gigahertz and allows sensor-sample distances as small as a few nanometres. As such, NV magnetometry provides access to static and dynamic magnetic and electronic phenomena with nanoscale spatial resolution. Pioneering work has focused on proof-of-principle demonstrations of its nanoscale imaging resolution and magnetic field sensitivity. Now, experiments are starting to probe the correlated-electron physics of magnets and superconductors and to explore the current distributions in low-dimensional materials. In this Review, we discuss the application of NV magnetometry to the exploration of condensed matter physics, focusing on its use to study static and dynamic magnetic textures and static and dynamic current distributions.