MADRID (AP) — With Real Madrid looking beaten and on the verge of elimination after a fierce comeback by defending champion Chelsea, Karim Benzema came up big once again in the Champions League.

Having scored a hat trick in the first leg to give Madrid a 3-1 lead, Benzema spoiled the English team’s comeback by netting the decisive goal in extra time on Tuesday to put the Spanish club back into the semifinals. After trailing 3-0 at home, Madrid pulled two goals back to secure a 5-4 aggregate victory despite a 3-2 loss at the Santiago Bernabéu Stadium.

“It was another incredible night at the Bernabéu,” said Madrid midfielder Luka Modric, who set up the hosts first goal. “We suffered but we never gave up. We kept fighting until the end and managed to advance. We gave everything we had and showed great character.”

Benzema also saved Madrid in the round of 16 by scoring a second-half hat trick in a 3-1 win against Paris Saint-Germain after Madrid had lost 1-0 in Paris and conceded early at the Bernabéu.

Benzema's 12th Champions League goal this season came with a header off a cross by Vinícius Júnior six minutes into extra time.

The hosts had looked defeated after going down 3-0 in regulation, but substitute Rodrygo evened the aggregate score in the 80th and Madrid found a way to reach the last four for the 10th time in the last 12 seasons.

Chelsea had overpowered Madrid early and built a lead through goals by Mason Mount in the 15th, Antonio Rüdiger in the 51st and Timo Werner in the 75th.

“Not many teams can come here and dominate them, as we did,” Rüdiger said. “Over the two legs, if you make the type of mistakes that we did, you get punished.”

Madrid will next face either Manchester City or Atlético Madrid, which play on Wednesday in the Spanish capital with City defending a 1-0 lead from the first leg.

Madrid coach Carlo Ancelotti has reached the Champions League semifinals for the eighth time as a manager, equaling the record held by José Mourinho and Pep Guardiola.

“We suffered a lot,” Ancelotti said. “In the end, after the 180 minutes, I think we deserved to advance.”

In the other quarterfinal on Tuesday, modest Spanish club Villarreal advanced past Bayern Munich 2-1 on aggregate after a 1-1 draw in the second leg in Germany.

The loss will add to Chelsea’s off-the-field turmoil amid the forced sale of the club after sanctions in Britain against oligarch owner Roman Abramovich following Russia’s invasion of Ukraine.

Chelsea had eliminated Madrid 3-1 on aggregate in last year's semifinals en route to its second Champions League title. But Madrid couldn’t play at the Bernabéu that time because the venue was undergoing major renovation work. Instead, the first leg was at the small Alfredo Di Stéfano Stadium in the club’s training center, a match that ended 1-1 before Chelsea won 2-0 in London.

On Tuesday, the defending champions looked the more dangerous team during most of the match but both sides had opportunities in a high-intensity encounter that went back-and-forth toward the end of regulation.

Chelsea’s American substitute Christian Pulisic had two good chances for a decisive goal in stoppage time but couldn’t capitalize on them. The visitors also had a couple of opportunities later in extra time as they pushed for a goal that would take it to penalties.

The English side got a dream start when Mount opened the scoring after quick touches by Ruben Loftus-Cheek and Werner caught the Madrid defense off guard and left the forward with an easy shot from inside the area.

The visitors got the second with a firm header by Rüdiger off a corner by Mount, and they thought they had another in the 62nd after Marcos Alonso scored from inside the area, but the goal was called back after video review because of a handball.

Instead, the third goal came when Werner scored from close range after a nice move to go past defenders in front of the net, but Madrid roared back five minutes later with a volley by substitute Rodrygo. It was set up by an exquisite pass by Luka Modric with the outside of his boot after Chelsea captain N’Golo Kanté gave the ball away with a bad pass near the sideline.

Former Chelsea goalkeeper Thibaut Courtois had made a good save to deny an attempt by Kai Havertz a few moments earlier.

Benzema, who struck a header off the crossbar in the 66th, had been mostly contained as Madrid struggled to move the ball into attack and kept giving Chelsea opportunities.

But one good chance in extra time was all he needed to make the difference once again.

___

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

___

Tales Azzoni on Twitter: http://twitter.com/tazzoni