We demonstrate experimentally the detection of magnetic force at optical frequencies, defined as the dipolar Lorentz force exerted on a photoinduced magnetic dipole excited by the magnetic component of light. Historically, this magnetic force has been considered elusive since, at optical frequencies, magnetic effects are usually overshadowed by the interaction of the electric component of light, making it difficult to recognize the direct magnetic force from the dominant electric forces. To overcome this challenge, we develop a photoinduced magnetic force characterization method that exploits a magnetic nanoprobe under structured light illumination. This approach enables the direct detection of the magnetic force, revealing the magnetic nearfield distribution at the nanoscale, while maximally suppressing its electric counterpart. The proposed method opens up new avenues for nanoscopy based on optical magnetic contrast, offering a research tool for all-optical spin control and optomagnetic manipulation of matter at the nanoscale.