GENEVA (AP)Barcelona was twice dragged back from the precipice of a humiliating Champions League elimination by Robert Lewandowski’s late goals on Wednesday.

An instant classic at Camp Nou saw Barcelona draw 3-3 with Inter Milan and barely cling to a slim hope of advancing to the round of 16.

Atletico Madrid is also on the brink after failing to score for a third straight game.

No such worries for Bayern Munich and unheralded Club Brugge who each advanced to the knockout stage with two rounds to spare as leaders of groups where Spanish powers are slumping in third place.

Free-scoring Napoli also progressed with a 4-2 win over Ajax to kick off a stunning evening in the Champions League that delivered 36 goals in eight games.

Mohamed Salah set a competition record with a hat trick in 6 minutes, 12 seconds – as a substitute midway through the second half – in Liverpool’s 7-1 blitz at Rangers.

Though it may just have been a stay of execution for Barcelona, the five-time European champion was grateful to be alive after a thrilling final few minutes against Inter.

Barcelona trailed 2-1 in the 82nd minute and was going out until Lewandowski’s shot was deflected into the Inter net.

The Italians led again in the 89th, when Robin Gosens finished a fast break, but Lewandowski rose again two minutes into stoppage time to head another leveler.

There was still time for Inter to waste chances to win, Barcelona goalkeeper Marc-Andre ter Stegen to make two more saves, and Inter coach Simone Inzaghi to be shown a red card.

Still, Inter now holds the head-to-head tiebreaker over Barcelona and will join Bayern advancing from Group C by beating over-matched Viktoria Plzen in two weeks’ time.

Bayern had a four-goal lead after just 35 minutes at Plzen but let its perfect defensive record slip in the second half of a 4-2 win.

Brugge goalkeeper Simon Mignolet ran his clean sheet streak to four games in a 0-0 draw at Atletico, to move four points clear of Porto and six clear of Atletico with the head-to-head tiebreaker.

Porto’s 3-0 win at Bayer Leverkusen included two penalties scored by Iran striker Mehdi Taremi.

Tottenham leads Group D for the first time after beating Eintracht Frankfurt 3-2, with first goals from Son Heung-min either side of a Harry Kane penalty. Kane also missed a late penalty.

Marseille rose to second place by winning 2-0 against Sporting Lisbon, which finished the game with nine men after two red cards.

BARCELONA’S FALL

Barcelona never failed to advance to the Champions League knockout round in the 17 years Lionel Messi was on the team.

Without him, back-to-back failures beckon in two weeks’ time with a game to spare.

Barcelona will be eliminated if it loses at home to Lewandowski’s former club Bayern on Oct. 26. Even a win will not be enough if Inter wins either of its last two games.

BRUGGE’S RISE

Club Brugge’s progress through this Champions League is a riposte to the Super League project that failed last year with Barcelona as one of the main drivers.

The Belgian champion has a storied European history, reaching two finals in the 1970s – losing both to Liverpool – went deep in the first Champions League in 1992-93 and has played often in it since.

However, Brugge became the kind of opponent Super League teams grew bored with and wanted to leave behind to get more money playing only each other.

Brugge was out of its depth on a long-awaited return to the Champions League groups in 2016-17, losing all six games.

Now six years and five campaigns later, Brugge has broken through in a group where it was the lowest-ranked team.

”In previous years, it just didn’t work out for us. We felt this year would be different,” said Mignolet, the former Liverpool goalkeeper who had nine saves at Atletico on Wednesday.

Porto’s 3-0 win at Leverkusen – in coach Xabi Alonso’s Champions League debut in the dugout for the Germans – lifted the two-time European champion into second place two points clear of Atletico. They meet in Portugal in the sixth and final round on Nov. 1.

LIVERPOOL REVIVES

When Liverpool trailed after 17 minutes at Rangers, it shaped to be another tough night in this stuttering start to the season where Jurgen Klopp’s team has yet to win on the road.

Seven minutes later Roberto Firmino leveled and the Brazil forward added a second in the 55th. Darwin Nunez, Salah and finally Harvey Elliott padded the lead.

Liverpool moved six points clear of third-placed Ajax in Group A and needs just a draw from their game in Amsterdam in two weeks.

AP World Cup coverage: https://apnews.com/hub/world-cup and https://twitter.com/AP-Sports