Magnetic resonance in an ensemble of laser-cooled trapped Rb atoms is excited using a microcantilever with a magnetic tip. The cantilever is mounted on a multilayer chip designed to capture, cool, and magnetically transport cold atoms. The coupling is observed by measuring the loss from a magnetic trap as the oscillating cantilever induces Zeeman-state transitions in the atoms. Interfacing cold atoms with mechanical devices could enable probing and manipulating atomic spins with nanometer spatial resolution and single-spin sensitivity, leading to new capabilities in quantum computation, quantum simulation, and precision sensing.