Although the pure electric drive system is widely applied to mobile machines, it is not easy for construction machinery (CM) to realize electrification because of the different working style. The CM load changes dramatically and continuously, and the traditional PI control cannot handle this condition. A vector control strategy based on speed sliding mode control (SMC) and torque PI control is proposed for CM with the characteristic of drastically changing loads. Based on the mathematical model of an electric motorpump, the electric motor-pump control performance requirement for electric CM is analyzed. Combined with the permanent magnet synchronous motor (PMSM) mathematical model, the speed SMC-PI observer is designed. The controller is designed using an exponential approximation method and uses integral and differential links, which has excellent robustness, to suppress flutter in SMC-PI. Control strategies of speed loops with PI and SMC-PI were compared under different conditions. The overshoot of the motor-pump speed was small and zero static control could be achieved. When the load was variable, the fluctuation of rotation speed was approximately 0.5% ∼ 1% with SMC-PI, which is only 25% ∼ 50% of PI control. Finally, the vector control algorithm based on speed SMC-PI was tested on a hydraulic excavator driven by the electric motor. The test results show that the vector control base on speed SMC-PI achieved a maximum static difference of rotational speed of approximately 1%. When the load power was close to 50% of the rated power, the electric motor-pump speed fluctuation range was −5% ∼ 5%, and the steady-state error was only approximately 0.3%.