It is a difficult to accurately estimate the rotor position in a surface permanent magnet synchronous motor (SPMSM), especially for low speed conditions because the back electromotive force (EMF) is almost zero. In this paper, an improved sliding mode observer (SMO) with a continuous sliding mode switching function (which could reduce the chattering effect) is proposed to estimate the real-time rotor position at a low speed. Through the introduction of an intermediate variable H , the back EMF is extended at low speed, which could improve the estimation accuracy for the rotor position. In addition, the chattering phenomenon is reduced by redesigning the sliding switching function. On the other hand, inverter nonlinearity also results in torque ripple and deteriorates the drive performance because of the harmonic components in the three-phase stator current. Here, a generalized sliding discrete Fourier transform (GSDFT) strategy is studied to extract the harmonic components, which can then be compensated with the corresponding compensation voltage calculated from the motor mathematical model. With the proposed strategy, the estimation accuracy can be apparently restricted when the rotor speed is lower than 50 rpm, while the chattering effect is also improved. With the nonlinearity compensation, the total harmonic distortion obviously decreases, which can improve the rotor estimation and the torque performance. In addition, the GSDFT algorithm executes in approximately half the time of the SDFT compensation method. INDEX TERMS Surface permanent magnet synchronous motor (SPMSM), low speed, sliding mode observer (SMO), inverter nonlinearity compensation, generalized sliding discrete fourier transform (GSDFT).