(CNN) -- He's the most expensive footballer in the world, but Cristiano Ronaldo is proving to be an absolute bargain buy for Real Madrid.
The Portugal forward took his goal tally to an incredible 49 in 47 league games since his $130 million move from Manchester United in 2009 as he fired his fourth hat-trick this season in Sunday night's 4-2 win over third-placed Villarreal.
The visitors had threatened to become the first team to win at the Santiago Bernabeu this season, leading 2-1 after 18 minutes, but Ronaldo completed his treble to put Real ahead and then set up a clinching goal by substitute Kaka to keep his side two points behind leaders Barcelona.
Kaka was delighted after his winning contribution, and also hailed Ronaldo's heroics.
"He has decided many matches and will continue to do so for Real Madrid. He is a great player that stuns us all day after day with goals and his way of playing. He is fundamental to this team," the former world player of the year said.
"To return to the Bernabeu and score was such a special moment. It had been a long time since I scored, so it was very important to me. I felt such raw emotion from the crowd."
Ronaldo has now scored 22 goals in 18 La Liga games this season, and 31 overall.
With defending champions Barca having beaten Deportivo La Coruna 4-0 on Saturday, Real were rocked when Ruben Cani put Villarreal ahead in the sixth minute.
But Ronaldo was on hand to equalize from close range three minutes later after Karim Benzema and Mesut Ozil combined well to set him up.
Benzema was starting up front in the continued absence of Argentine striker Gonzalo Higuain, who will have back surgery on Tuesday. The Real squad took to the pitch wearing shirts supporting him with the words "Stay strong Pipa. Get well soon."
But it was Villarreal who scored next as Marco Ruben beat the offside trap and sent a delightful chip over goalkeeper Iker Casillas for his first goal for the club.
Ronaldo struck a vital blow when he equalized in the first minute of time added on, stealing a header from Xabi Alonso's free-kick.
But Real struggled to find a winner until Kaka came on for his first home appearance this season with 20 minutes to play, having returned as a substitute in the meaningless midweek Spanish Cup second-leg defeat at Levante.
Nine minutes later the Brazilian's cross was not dealt with by Villarreal keeper Diego Lopez, and Ronaldo finally fired in a low shot after the ball ran loose -- though he appeared to have come back from an offside position.
There was no doubt about the fourth goal on 82 minutes, as Ronaldo slipped a clever pass into the box and Kaka poked the ball past Lopez.
Real coach Jose Mourinho's wild celebrations prompted an angry reaction on the Villarreal bench, with coach Juan Carlos Garrido already sent off for protesting the third goal.
Real return to action on Thursday for the first leg of the Spanish Cup quarterfinal against city rivals Atletico, who travel to Hercules in La Liga on Monday.
In Sunday's other games, fourth-placed Valencia closed the gap on Villarreal to two points after a controversial 1-0 win in the derby at Levante.
Juan Mata followed up his late winner in last weekend's win over Espanyol with another goal that appeared to be offside as he broke free to score with seven minutes left.
The winger missed a first-half penalty, clipping the top of the crossbar, and then in the second half he had a curling free-kick tipped onto the woodwork.
Espanyol are a point back in fifth after thrashing bottom club Real Zaragoza 4-0 at home, while Mallorca joined sixth-placed Atletico and Getafe on 27 points with a 4-1 win over relegation-threatened Almeria.
Getafe could only draw 0-0 at Osasuna, who moved five points clear of the bottom three.
Sporting Gijon moved above Almeria and Zaragoza on goal difference after drawing 1-1 at Racing Santander thanks to a 90th-minute equalizer from midfielder Diego Castro.