In an electric motor, periodically changing the direction of current in the electromagnet can cause the axle to spin because of the reversing of magnetic field direction.
Explanation
An electric motor consists of a long rod termed as axle which is connected to the electric current.
When the current will be flowing through the axle, a magnetic field will be generated around the axle due to magnetic induction.
The axle is positioned between two strong electromagnets. So when the magnetic field is generated around the axle, depending upon the direction of flow of current, the magnetic field can get attracted or repelled by the electromagnets.
Thus the change in the direction of current flow will lead to reverse in the direction of magnetic field generated around the axle causing it to spin.