Watch La Liga goal king chart: Ronaldo's 300th keeps him ahead of Messi
A spirited second half display and change of system from Carlo Ancelotti saw Real Madrid overcome a stubborn Rayo Vallecano side to claim a hard-fought 2-0 win and close the gap on Barcelona.
Ancelotti's side came into the game on Wednesday at the Vallecas seven points behind the Liga leaders following their 4-0 win over Almeria earlier, with Rayo Vallecano enjoying the better of the first half as they went toe-to-toe with Real.
But Real Madrid's superior quality and threat in attack told in the second half, with Cristiano Ronaldo heading home the opener after 68 minutes following excellent work by Dani Carvjal down the right wing.
Ronaldo joins Raul and Di Stefano as the only players to score 300 goals for Real Madrid.
Lionel Messi also scored in Barca's 4-0 win against Almeria to keep the difference between himself and the Portugal star at four goals.
Race for the Pichichi
1 Cristiano Ronaldo 37 Real Madrid
2 Lionel Messi 33 FC Barcelona
3 Carlos Bacca 17 Sevilla FC
3 Neymar 17 FC Barcelona
5 Antoine Griezmann 16 Rayo Vallecano
6 Alberto Bueno 16 Atlético Madrid
6 Karim Benzema 15 Real Madrid
8 Gareth Bale 13 Real Madrid
9 Mario Mandzukic 12 Atlético Madrid
9 Luciano Vietto 12 Villarreal CF
11 Ad ú riz 11 Athletic Club
Follow Gary on Twitter: @garyalsmith
Story by Ghana/Joy Sports/Gary Al-Smith