A method of controlling a synchronous machine (M) by means of an electrical drive , wherein the method comprises: a) obtaining a current reference vector i dq ∗ for a torque reference ( τ *), from at least one current look-up table (LUT-i d , LUT-i q ), which at least one current look-up table (LUT-i d , LUT-i q ) describes relations between currents and torques for the synchronous machine (M), and obtaining a flux linkage vector (λ dq ) for the current reference vector i dq ∗ , from a flux linkage look-up table (LUT-λ) describing relations between currents and flux linkages, b) determining an adjustment part voltage vector ( ε dq ) by means of a regulator , based on a difference between the current reference vector i dq ∗ and a measured current ( i dq ) , characterised by c) determining a flux linkage adjustment vector (Δ λ dq_I ) and a torque reference error (Δτ I ) based on the adjustment part voltage vector ( ε dq ), the torque reference error (Δ τ I ) being determined further based on the measured current ( i dq ), d) generating a compensated torque reference ( τ **) by summing the torque reference ( τ *) and the torque reference error (Δ τ I ), e) obtaining a new current reference vector i dq ∗ for the compensated torque reference τ ∗ ∗ , from the at least one current look-up table (LUT-i d , LUT-i q ), and obtaining a new flux linkage vector ( λ dq ) for the new current reference vector i dq ∗ from the flux linkage look-up table (LUT-λ), f) determining an adjusted voltage reference vector û dq ∗ based on the new current reference vector i dq ∗ , and on the sum of the new flux linkage vector (λ dq ) and the flux linkage adjustment vector (Δλ dq_I ) by means of a model describing the dynamics of the synchronous machine (M), and g) controlling the synchronous machine (M) by means of the electrical drive based on the adjusted voltage reference vector û dq ∗ . a) obtaining a current reference vector i dq ∗ for a torque reference ( τ *), from at least one current look-up table (LUT-i d , LUT-i q ), which at least one current look-up table (LUT-i d , LUT-i q ) describes relations between currents and torques for the synchronous machine (M), and obtaining a flux linkage vector (λ dq ) for the current reference vector i dq ∗ , from a flux linkage look-up table (LUT-λ) describing relations between currents and flux linkages, b) determining an adjustment part voltage vector ( ε dq ) by means of a regulator , based on a difference between the current reference vector i dq ∗ and a measured current ( i dq ) , characterised by c) determining a flux linkage adjustment vector (Δ λ dq_I ) and a torque reference error (Δτ I ) based on the adjustment part voltage vector ( ε dq ), the torque reference error (Δ τ I ) being determined further based on the measured current ( i dq ), d) generating a compensated torque reference ( τ **) by summing the torque reference ( τ *) and the torque reference error (Δ τ I ), e) obtaining a new current reference vector i dq ∗ for the compensated torque reference τ ∗ ∗ , from the at least one current look-up table (LUT-i d , LUT-i q ), and obtaining a new flux linkage vector ( λ dq ) for the new current reference vector i dq ∗ from the flux linkage look-up table (LUT-λ), f) determining an adjusted voltage reference vector û dq ∗ based on the new current reference vector i dq ∗ , and on the sum of the new flux linkage vector (λ dq ) and the flux linkage adjustment vector (Δλ dq_I ) by means of a model describing the dynamics of the synchronous machine (M), and g) controlling the synchronous machine (M) by means of the electrical drive based on the adjusted voltage reference vector û dq ∗ . <EOS>