BARCELONA, Spain (AP) -- Cristiano Ronaldo scored his Spanish league-leading 25th goal to give Real Madrid a lackluster 1-0 win at Malaga on Saturday, when the pacesetters extended their unbeaten run to 30 matches in all competitions.
Diego Costa made sure Atletico Madrid stayed within three points of its crosstown rivals by scoring his 22nd league goal of the season in a 1-0 win at home over Espanyol.
Ronaldo netted the winner in the 23rd minute, and a tired-looking Madrid team was fortunate Malaga failed to muster a comeback after pushing the visitors into their area for the final 10 minutes.
Third-place Barcelona will enter Sunday's match against Osasuna seven points behind Madrid in the league standings. The two powerhouses are set to clash in the Spanish capital next weekend.
Madrid's win was tarnished by the loss of Karim Benzema to a right thigh injury after colliding with Ronaldo in the first half.
''We suffered, above all in the second half,'' Madrid midfielder Xabi Alonso said. ''They pressed us and it was tough for us to move the ball. These are three important points. There are 10 games left and we have to play each one like it's the last.''
Elsewhere, Rayo Vallecano beat Almeria 3-1 to provisionally escape the relegation zone with a third consecutive victory, while Celta Vigo earned an entertaining 1-0 win at Levante.
The opening stage of the match at La Rosaleda Stadium was a vibrant back-and-forth exchange before Ronaldo put Madrid ahead with a wonderful solo effort.
He appeared to be hemmed in by two defenders on the edge of the area, but he took three touches to his right and lashed a bouncing strike beyond goalkeeper Willy Caballero. Ronaldo's goal gave him 39 goals from 36 games in all competitions this season.
Ronaldo went close again twice, first being blocked by Caballero and then sending Gareth Bale's lobbed pass into the side netting before he ran into Benzema.
Benzema was treated on the sideline by team doctors before he replaced by Angel Di Maria in the 31st.
Former Malaga player Francisco ''Isco'' Alarcon, who joined Madrid this summer, wasted a golden chance in the 51st when he sent the ball sailing high after Di Maria set him up for a one-on-one with Caballero.
Madrid, dominant in the first half, lost control of the ball and Malaga tilted the match in its favor led by tireless forward Nordin Amrabat. But defender Sergio Sanchez missed his team's most promising opportunity to level in the 76th.
''This team is consistent game after game,'' Madrid coach Carlo Ancelotti said. ''We are ready for the clasico.''
But before receiving fierce rival Barcelona, Madrid hosts Schalke on Tuesday with one foot in the Champions League quarterfinals after winning their first meeting 6-1.
Atletico coach Diego Simeone continued to play down his team's title chances, for now, saying there's a long way to go in the season.
''When there are five games left and we are in the same situation, you will hear me say something different,'' he said.
The first half at Vicente Calderon Stadium was dominated by the defenses and featured a good save each by Atletico's Courtois Thibaut and Espanyol's Kiko Casilla.
Diego Costa broke through in the 55th when he received a throughball from David Villa, easily fended off Diego Colotto's timid attempt to slow him down, and fired the ball past Casilla.
''Espanyol played a great game and complicated our lives a lot,'' Diego Costa said. ''But that just makes us stronger.''
Rayo won thanks to Joaquin Larrivey's double after Alberto Bueno headed in the opener. Fernando Soriano scored for Almeria.
Rayo rose three points above the danger zone. Almeria was left in the drop zone along with Valladolid and Real Betis before they play on Sunday.
Celta forward Manuel ''Nolito'' Agudo scored from a counterattack in the 19th. David Barral missed a penalty for Levante in the 61st.
Copyright 2014 Associated Press. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.