Micromanipulation of magnetotactic bacteria with a microelectromagnet matrix was demonstrated. Magnetotactic bacteria synthesize a chain of magnetic nanoparticles inside their body to guide their motion in the geomagnetic field. A microelectromagnet matrix consists of two arrays of lithographically patterned wires, one array perpendicular to the other, that are separated and covered by insulating layers. By adjusting the current in each wire, a matrix can create versatile magnetic field patterns on microscopic length scale. Using a matrix, magnetotactic bacteria were trapped, continuously moved, rotated, and assembled in water at room temperature.