The invention provides a motor and a control method thereof. The motor comprises a shell, a stator and a rotor, wherein the stator is arranged in the shell, the rotor is arranged at a radial inner side of the stator, the shell is provided with a rear end cover, a shaft end groove is formed in the rear end cover, the rotor is provided with an output shaft, a rear end of the output shaft is insertedinto the shaft end groove, the motor also comprises a play-prevention device and a play detection device, the play-prevention device is provided with an electromagnet and a permanent magnet, the electromagnet is arranged at the bottom of the shaft end groove, the permanent magnet is arranged at a rear end of the output shaft, and the play detection device is configured to detect displacement between a real-time position and an initial position of the output shaft and control the size and the direction of a current of the electromagnet according to the displacement so as to further control thesize of an acting force between the electromagnet and the permanent magnet and maintain the output shaft at the initial position. When axial display occurs in the output shaft, the current supplied to the electromagnet is controlled, the permanent magnet is pushed to drive the output shaft to move towards an opposite direction of an axial play direction, axial play is generated, and the rotationof the output shaft cannot be affected.