The paper analyses torsional vibrations caused by electromagnetic torque harmonics in permanent magnet synchronous generators. A vibration mitigation method is proposed based on changing the phase angle of the carrier signal of sinusoidal PWM in order to invert the phase of the torque harmonic causing resonance. Since the frequency has not changed, the system is still in resonance. Thus, after a given time, the torque harmonic should be inverted again. The process is repeated as long as the system is at or near resonance. A criterion is presented to select the exact phase shift of the carrier needed in order to invert the torque harmonic. A method to calculate both the toggle time needed and the frequency range to apply such technique is presented. With the mitigation technique applied, two cases are considered on Matlab/Simulink, namely sustained operation at resonant frequency and accelerating the machine over some critical points.