A silicon nanowire is used as an ultrasensitive cantilever in order to detect nuclear spins via magnetic resonance. A thin layer of polystyrene, containing weakly magnetic hydrogen nuclei, coats the end of the nanowire. A microfabricated wire serves as an electromagnet to produce a magnetic field gradient and thereby exert a force on the spins. Through a suitable modulation of the current in the wire, the interaction between the spins and the field gradient drives the silicon nanowire at its resonance frequency. The motion is then sensed with a laser. The hope is that the improved sensitivity afforded by this technique will eventually allow nanomagnetic resonance on the molecular scale.