Answer
The armature of a motor spins, transforming electrical energy to mechanical energy. The spinning coils, moving in a magnetic field, also induce a voltage (tending to drive electric current in the opposite direction). Thus a motor also tends to act as a generator.
Work Step by Step
If you are interested in further investigation, the term to look up is "back emf".