BARCELONA, Spain — Atlético Madrid needed a goal by Marcos Llorente and a penalty miss by Elche in injury time to grind out a 1-0 win and ensure it stayed at the top of the Spanish league on Saturday.

Real Madrid stayed two points back after late goals by Éder Militão and Casemiro defeated a feisty Osasuna 2-0.

Other than Llorente’s first-half goal, Atlético relied on its defence and almost paid for it in the final moments when Llorente used his arm to disrupt a cross into the box. But Diego Simeone’s side dodged another costly stumble away from home when Elche’s Fidel Chaves fired the resulting penalty kick off the left post.

“It was an obligation to win today,” Llorente said after his 12th league goal of the season. “These three points give us a lot of strength for what’s ahead. Winning is always a boost to the team’s spirit and confidence, and even more so now that we are reaching the finale.”

Atlético’s first road victory in five trips ensured it stayed ahead of Madrid.

Barcelona is five points off the pace before visiting Valencia on Sunday, and Sevilla is six points back when it hosts Athletic Bilbao on Monday.

Then comes next weekend’s pair of head-to-head clashes between the challengers: Atlético visits Barcelona on May 8, and the next day Madrid hosts Sevilla. After that, there will only be three rounds left.

CLOSE CALL

Llorente scored in a match dominated by defence in the 24th when Yannick Carraso dribbled to the end-line and assisted the midfielder in the heart of the box. Llorente’s shot took a deflection off a defender.

Ahead in the score, Atlético’s defence clamped down until the final minutes when the relegation-threatened Elche finally threatened Jan Olbak’s goal only to come up empty.

Atlético once looked ready to run away to its first title since 2014 after it opened up double-digit leads over Madrid and Barcelona. But the advantage has been squandered. It has seven wins in the last 15 rounds, and only Granada’s shock win at Camp Nou on Thursday ensured it did not lose the lead to Barcelona.

Even though his side is still not playing like a champion-in-the-making, Simeone wants to transmit the message that the red-and-whites are still in command.

“Now is not the time to think. This is the moment for action," Simeone said. "We controlled the first 75 minutes, but when you don’t put it away you know what can happen, the danger that two points that can prove decisive could slip away.”

LEAVING IT LATE

Zinedine Zidane rested Luka Modric and Toni Kroos for Madrid's visit to Chelsea on Wednesday to decide their Champions League semifinal after a 1-1 draw in the first leg.

Eden Hazard started his first match after his latest injury, along with reserve team midfielder Antonio Blanco.

Osasuna tightened its defence after halftime, but centre back Militão broke the deadlock in the 76th when he headed a corner kick by Isco Alarcón just inside the post.

Four minutes later, Casemiro knocked in a through ball from Karim Benzema to seal the win for the defending champions.

“The rival defended well but with patience we got the result," Zidane said. "I am happy for (Militão) because he was patient. He worked a lot, waited for his turn and now is playing more and playing well.”

The emergence of Militão as a player who can hold his own as a starter while Sergio Ramos is absent, comes as Madrid may have lost another defender for the trip to Stamford Bridge.

Raphael Varane was substituted at halftime for an undisclosed physical problem. Zidane said Varane believed it was not serious but that he would undergo tests.

HAT TRICK FOR HOPE

Kike García scored a hat trick to help last-placed Eibar beat Alavés 3-0 and give it hope of avoiding relegation.

Eibar’s first victory in 17 rounds left it four points from safety.

OUT OF THE DROP

Huesca’s Sandro Ramírez scored from a free kick that went in off a Real Sociedad defender to snatch an 88th-minute winner. The 1-0 victory lifted Huesca out of the drop zone.

___

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports