We present a new type of magnetic field detector that uses a nonlinear micromechanical oscillator for sensing. This is the first fabricated magnetometer that takes advantage of the geometrically induced nonlinearities in a clamped-clamped beam. It does not incorporate magnetic materials, and its fabrication is fully compatible with standard semiconductor processes. In this sensor, the magnetic field B applied to the resonant beam can be detected by measuring the shift that it produces in fpeak, the frequency of maximum oscillation amplitude. This frequency shift is linked to a reduction of the quality factor and only occurs if the oscillator is in the nonlinear regime. It is originated by the ohmic losses induced by the applied magnetic field, which dissipate part of the mechanical energy stored in the oscillator.