A method of controlling a permanent magnet motor , the method at least comprising: applying closed-loop control to the speed of the motor to match a reference speed (ω ref ) by comparing a measured q-axis stator current (Iqm) of the motor to a reference q-axis stator current (Iqr) of the motor and deriving a difference (lq_difference) therebetween; checking whether the difference (lq_difference) between the measured and reference q-axis stator currents of the motor is greater than a threshold value (lqErrorThreshold) at which a phase current amplitude of the motor starts to vary according to the number of poles of the motor; characterized by : if not, setting the reference speed (ω ref ) of the motor equal to an application reference speed (ApplicationSpeedRef) and returning to closed-loop control of the speed of the motor; if so, setting the reference speed (ω ref ) of the motor equal to a temporary reference speed (TemporarySpeedRef) and checking whether the temporary reference speed (TemporarySpeedRef) is less than the application reference speed (ApplicationSpeed Ref); if not, setting the reference speed (ω ref ) equal to the application reference speed (ApplicationSpeedRef) and returning to closed-loop control of the speed of the motor; if so, changing a phase offset angle (theta) between stator and rotor magnetic fields of the motor before returning to closed-loop control of the speed of the motor. applying closed-loop control to the speed of the motor to match a reference speed (ω ref ) by comparing a measured q-axis stator current (Iqm) of the motor to a reference q-axis stator current (Iqr) of the motor and deriving a difference (lq_difference) therebetween; checking whether the difference (lq_difference) between the measured and reference q-axis stator currents of the motor is greater than a threshold value (lqErrorThreshold) at which a phase current amplitude of the motor starts to vary according to the number of poles of the motor; characterized by : if not, setting the reference speed (ω ref ) of the motor equal to an application reference speed (ApplicationSpeedRef) and returning to closed-loop control of the speed of the motor; if so, setting the reference speed (ω ref ) of the motor equal to a temporary reference speed (TemporarySpeedRef) and checking whether the temporary reference speed (TemporarySpeedRef) is less than the application reference speed (ApplicationSpeed Ref); if not, setting the reference speed (ω ref ) equal to the application reference speed (ApplicationSpeedRef) and returning to closed-loop control of the speed of the motor; if so, changing a phase offset angle (theta) between stator and rotor magnetic fields of the motor before returning to closed-loop control of the speed of the motor. if not, setting the reference speed (ω ref ) of the motor equal to an application reference speed (ApplicationSpeedRef) and returning to closed-loop control of the speed of the motor; if so, setting the reference speed (ω ref ) of the motor equal to a temporary reference speed (TemporarySpeedRef) and checking whether the temporary reference speed (TemporarySpeedRef) is less than the application reference speed (ApplicationSpeed Ref); if not, setting the reference speed (ω ref ) equal to the application reference speed (ApplicationSpeedRef) and returning to closed-loop control of the speed of the motor; if so, changing a phase offset angle (theta) between stator and rotor magnetic fields of the motor before returning to closed-loop control of the speed of the motor. <EOS>