An M-shaped tractive digitalized energy-saving oil pumping unit is composed of a unit frame, an upper platform, a motor, a braking system, a traction system, a counterweight system, a control system, a polished rod breaking emergency safety mechanism and a folding yielding mechanism. The motor is a rare-earth permanent magnet synchronous motor with an outer rotor, low rotation speed and high torque, traction wheels are coaxial with the motor and arranged on two sides of the motor, a steel wire rope is wound in an M-shaped mode and serves as the traction system, the reciprocating motion of the oil pumping unit is achieved through forward and reverse rotation of the motor, the forward and reverse rotation and the running speed of the motor are controlled by the control system through digitalized program, the braking system is arranged on the outer edge of the outer rotor of the motor, the polished rod breaking emergency safety mechanism is arranged in a counterweight box, and the folding yielding mechanism is arranged on the front side of the upper platform and is folded by using a hand-held winch during well repair so as to reserve an operation space for a well repair machine without machine moving. The M-shaped tractive digitalized energy-saving oil pumping unit saves energy and is safe and reliable.