Kevin Grosskreutz scored in the dying stages as Borussia Dortmund beat Marseille 2-1 to clinch top spot in UEFA Champions League Group F.
Jurgen Klopp's men went into the game knowing that a win would be enough to see them qualify for the next stage, but any sort of slip-up would afford Napoli the chance to progress.
Last season's beaten finalists looked to be on their way to a routine victory when Robert Lewandowski put them ahead in the opening stages.
However, Marseille - managed by sporting director Jose Anigo following Elie Baup's dismissal last week - quickly levelled matters through defender Souleymane Diawara as they sought to avoid the ignominy of finishing the group stage with no points.
Dortmund wasted numerous chances to go back in front in a one-sided second half at the Stade Velodrome, Lewandowski and Marco Reus among those to miss gilt-edged opportunities.
But the Bundesliga club finally breached a stout Marseille defence as Grosskreutz struck three minutes from time to seal top spot as previous group leaders Arsenal were beaten 2-0 at Napoli.
Defender Rod Fanni made his return from injury for Marseille, while Benjamin Mendy and Saber Khelifa were also included in the starting XI by Anigo.
Nuri Sahin recovered from an ankle problem to feature in the Dortmund line-up as Klopp handed starting berths to youngsters Marian Sarr and Erik Durm.
Dortmund took the lead after just three minutes, left-back Durm playing an influential role as he played in Lewandowski with a deft pass, with the Poland striker making no mistake as he coolly lifted the ball over Steve Mandanda.
However, the visitors' hopes of qualification were dealt a blow 11 minutes later when Diawara headed into an empty net after Khelifa had turned Dimitri Payet's superb free-kick against the crossbar.
Dortmund continued to dictate an extremely open game, though, but struggled to create many meaningful chances. Reus went closest just after the half-hour mark when he blazed over the bar following a swift counter-attack.
But the German outfit's fortunes turned shortly after as Payet was dismissed for a second booking in a matter of minutes after referee Marijo Strahonja ruled that the winger had dived in an attempt to win a penalty from a challenge with Sahin.
Marseille remained a threat despite their numerical disadvantage, however, with Andre-Pierre Gignac forcing Roman Weidenfeller into action before Reus spurned another opportunity at the other end prior to the interval.
Anigo's men rode their luck for much of the second period, and they were fortunate not to fall behind on two separate occasions, Reus hitting the post shortly after Mandanda had produced a brilliant far-post save to keep out Jakub Blaszczykowski's header.
Dortmund should have re-taken the lead in bizarre fashion after 66 minutes when Lewandowski intercepted Mendy's backpass, only to hit the side netting after rounding Mandanda.
Klopp's men refused to let up as they heaped further pressure on the Marseille defence, Reus somehow missing the target from point-blank range with the goal at his mercy.
And Dortmund were then denied a penalty in the closing stages after Mandanda collided with Lewandowski, but this proved immaterial as Grosskreutz's effort from the edge of the area snuck into the bottom corner to ensure their progression.
|Ronaldo proud to compete with Messi|
|Wenger struggling to solve Arsenal goal drought|
|Pique wants to face Guardiola, City in Champions League final|
|Tevez nearing Boca Juniors return|
|Ronaldo? I was better, says Gremio coach Renato|
|Pique: I understood why Neymar left Barca for PSG|
|Klopp: We´re all fighting for second place|
|Every player has a price – Mourinho hints at January exits|
|Good question! Guardiola ducks Sanchez link and lauds Walker|
|Guardiola addresses Mourinho´s tactical foul claims|
|Call the doctor! Conte protests no malice in David Luiz absence|
|Sheffield Wednesday 0 Wolves 1: Brilliant Neves fires leaders seven clear|
|Premier League title City´s to lose, but Sterling wary of United charge|
|Barcelona´s Deulofeu a Clasico doubt after training injury|
|Salah ´is a player I rate a lot´, says Zidane|
|Allardyce lauds ´invaluable´ Rooney|
|Ramos fit for Club World Cup final|
|Lille sack Bielsa to end failed experiment|
|Manchester United job like Real Madrid, says Mourinho|
|Fernandinho is much better than I was, Guardiola claims|
|That Harry Kane team? – I´m over Guardiola dig, says Pochettino|
|Mourinho open to January moves as Griezmann rumours swirl|
|Berizzo set for Sevilla return after cancer surgery|
|Manchester City will not go unbeaten in Premier League - Guardiola|
|Man City are the best – Pochettino braced for Spurs´ toughest test|
|Conte hopeful over David Luiz´s ´serious´ knee injury|
|Neymar not an injury risk after Brazil trip - Emery|
|Bailly to miss three months due to ankle surgery|
|Klopp defends Liverpool rotation policy|
|Arsenal fan Prince Harry´s wedding day to clash with FA Cup final|
|He´s one of the best – Simeone showers Oblak with praise|
|Juventus won´t sell in-demand Pjaca, agent claims|
|Bolasie in line for Everton return after long-term injury|
|Maradona told Real Madrid to sign Mbappe|
|Sydney FC 3 Melbourne City 1: Champions come from behind to go eight points clear|
|Red-hot Salah wins Player of the Month|
|Heynckes unaware of reported Sanches loan termination|
|Maradona: I´d have won more Ballons d´Or than Ronaldo and Messi|
|Wenger confirms Wilshere contract talks imminent|
|We´ve never been approached by Man United – Wenger rejects Ozil reports|
|Lewandowski demands focus ahead of Christmas|
|Klopp right to rotate at Liverpool – Neville|
|Donnarumma plays down Milan exit rumours|
|Barkley could leave in January – Allardyce|
|Pulisic voted youngest-ever male USA player of the year|
|Griezmann will be allowed to leave – Simeone|
|Guardiola appears to aim another dig at Mourinho|
|Vardy relishing Fleetwood return|
|Almiron blocked from becoming Las Palmas coach|
|Ligue 1 adopts VAR from next season|
|Calabria extends AC Milan contract|
|Everton give new deals to Calvert-Lewin, Holgate & Kenny|
|Under-fire Hughes promises results will come for Stoke|
|Mourinho asked to explain pre-Manchester derby comments|
|Stoger sets Dortmund end of year target|
|Dyche: No swaggering from high-flying Burnley|
|Watzke plays down Nagelsmann rumour as Dortmund plan for 2018|
|Guardiola´s record runs with Manchester City, Bayern Munich and Barcelona compared|
|Benteke goal drought a concern for Hodgson|
|City look frightening – Rose|
|Kahn regrets rejecting Manchester United|
|Bayern wrapping up Ribery for Christmas|
|Wilshere no closer to signing fresh Arsenal contract|
|Resurgent Rooney has Europe´s best shot-conversion record|
|Pastore bullish over PSG chances against Madrid|
|Independiente boss overjoyed by ´dream´ Copa Sudamericana success|
|Silva is an animal - Guardiola|
|Wenger not blaming Sanchez for Arsenal´s goal woes|
|Mourinho can´t find room for misfiring Mkhitaryan|
|Guardiola tells fans Man City won´t stop after record-breaking win|
|Mirabelli: Donnarumma has to beg Milan if he wants to leave|
|Bayern lacked verve, says Heynckes|
|Di Maria wants more game time at PSG after goalscoring display|
|Gattuso: Donnarumma shaken by abuse from AC Milan fans|
|Pellegrino calls for Southampton reaction|
|Benitez ´needs to know´ extent of Newcastle´s transfer budget|
|Zidane will not request striker signing despite Benzema blanks|
|Bournemouth excellent in Old Trafford loss – Howe|
|Wilshere´s performance ´very positive´, says Wenger|
|Pochettino challenges Spurs to keep top-four berth|
|I´d be in Brazil if the title race was over – Mourinho|