A method of operating a wind turbine having a rotor with a plurality of blades, a nacelle, one or more pitch systems for pitching the blades, a system for determining a speed of the rotor, and a system for determining a fore-aft speed of the nacelle (122, 125); the method comprising: determining the speed of the rotor; determining the fore-aft speed of the nacelle; calculating a difference between the determined speed of the rotor and a predefined speed of reference of the rotor; obtaining pitch commands by performing a PID control of said calculated difference of speeds, wherein said PID control is tuned for adapting the sensitivity of the PID control as a function of the determined fore-aft speed of the nacelle; the one or more pitch systems pitching the blades in accordance with said obtained pitch commands; characterized in that tuning the PID control comprises obtaining a first gain (Kp) equal to a first variable gain value which increases from a lower value to a higher value of a first predefined range of gain values as the determined fore-aft speed of the nacelle (Vx) increases from a lower value to a higher value of a first predefined range of fore-aft speed values; obtaining a second gain (Ki) equal to a second variable gain value which decreases from a higher value to a lower value of a second predefined range of gain values as the determined fore-aft speed of the nacelle (Vx) increases from a lower value to a higher value of a second predefined range of fore-aft speed values; applying the obtained first gain (Kp) to the PID control for adapting the proportional constant of the PID control; and applying the obtained second gain (Ki) to the PID control for adapting the integral constant of the PID control. determining the speed of the rotor; determining the fore-aft speed of the nacelle; calculating a difference between the determined speed of the rotor and a predefined speed of reference of the rotor; obtaining pitch commands by performing a PID control of said calculated difference of speeds, wherein said PID control is tuned for adapting the sensitivity of the PID control as a function of the determined fore-aft speed of the nacelle; the one or more pitch systems pitching the blades in accordance with said obtained pitch commands; characterized in that tuning the PID control comprises obtaining a first gain (Kp) equal to a first variable gain value which increases from a lower value to a higher value of a first predefined range of gain values as the determined fore-aft speed of the nacelle (Vx) increases from a lower value to a higher value of a first predefined range of fore-aft speed values; obtaining a second gain (Ki) equal to a second variable gain value which decreases from a higher value to a lower value of a second predefined range of gain values as the determined fore-aft speed of the nacelle (Vx) increases from a lower value to a higher value of a second predefined range of fore-aft speed values; applying the obtained first gain (Kp) to the PID control for adapting the proportional constant of the PID control; and applying the obtained second gain (Ki) to the PID control for adapting the integral constant of the PID control.