BARCELONA, Spain (AP) -- Cristiano Ronaldo hit a hat trick as Real Madrid warmed up for its Copa del Rey clash with Barcelona by rolling to a 4-0 home victory over Getafe in the Spanish league on Sunday.
Sergio Ramos scored in the 53rd minute after Ricardo Carvalho forced goalkeeper Miguel Moya to fumble the ball by hitting his arms in an apparent foul that went unpunished.
"I don't know if I fouled him or not," Carvalho said. "It all happened so fast. I jumped and I don't know if I touched him."
Ronaldo then scored three times in an 11-minute span to give him 21 goals in league play this season, second only to Barcelona's Lionel Messi with 29.
Madrid's win kept it in third place and provisionally reduced the gap with Barcelona to 12 points before the league leaders hosted Osasuna later Sunday.
Madrid hosts Barcelona in the first leg of their Copa del Rey semifinal on Wednesday.
Also on Sunday, Rayo Vallecano beat visiting Real Betis 3-0 to provisionally move into fifth place, one point behind Betis in fourth.
Even though its league title defense looks almost impossible, Carvalho said Madrid was still going all out for victory.
"The most important thing is to win games, in the league as well, since it makes us stronger for the Copa del Rey and Champions League," Carvalho said.
Madrid hosts Manchester United in the Champions League knockout stage on Feb. 13.
Adan Garrido started in Madrid's goal after Iker Casillas broke his hand on Wednesday and underwent an operation on Friday. He will be out for eight to 12 weeks. Madrid signed goalkeeper Diego Lopez from Sevilla on Saturday, and he was on the bench for the game versus Getafe.
With the "clasico" looming, Madrid coach Jose Mourinho held back Xabi Alonso and only played Sami Khedira and Mesut Oezil 45 minutes each.
Madrid had the better share of the scoring chances in a subdued first half. Ronaldo tested Moya with a bouncing free kick 10 minutes in, before drawing a save from the Getafe 'keeper in the 22nd.
Moya again responded well to turn away back-to-back attempts by Khedira and Fabio Coentrao moments before Madrid finally scored after Carvalho's collision with Moya.
"It was clearly a foul," Getafe coach Luis Garcia said. "It's a pity. When you are losing you have to push forward, and that's what let them get out on the break. Madrid is the best team in the world on the counterattack."
Ahead 1-0, Madrid didn't look back.
Ronaldo finished off a counterattack from its own area in the 62nd, running onto Oezil's pass and firing the ball beyond Moya and inside the far upright.
Three minutes later, Ronaldo made it 3-0 as he charged in unmarked behind Gonzalo Higuain to head home Angel Di Maria's floated cross at the far post.
Ronaldo dispatched a penalty kick into the lower left corner in the 72nd to record his second hat trick in league play this season after Alberto Lopo fouled Luka Modric in the box.
The Portugal forward, rarely substituted, was taken off seconds later to the applause of the Santiago Bernabeu crowd.
Later Sunday, second-place Atletico Madrid visits Athletic Bilbao, while Malaga is at Mallorca.