Match ends, Marseille 1, Borussia Dortmund 2.
Borussia Dortmund scraped into the last 16 of the Champions League with Kevin Grosskreutz's 87th-minute strike giving them victory over 10-man Marseille.
Dortmund's Robert Lewandowski beat the offside trap to open the scoring for last season's runners-up with a chip.
But Marseille, who had Dimitri Payet sent off after he picked up a second yellow card for diving, equalised when Souleymane Diawara headed in a rebound.
Dortmund were heading out until Grosskreutz scored the winner.
Before the midfielder bobbled a low shot into the corner, the German side were set for a place in the Europa League, with Napoli heading through behind Arsenal in Group F.
But the goal not only put Jurgen Klopp's men into the last 16, it also proved enough for them to win the group and avoid playing the top seeds.
Arsenal will now have to play Real Madrid, Paris St-Germain, Bayern Munich, Atletico Madrid or Barcelona in the knockout stages after
"This feels fantastic, that was a nerve-shredding game," said Klopp.
"We were in their penalty area every 30 seconds but somehow the ball would not go in."
Lewandowksi chipped in to put Dortmund ahead before Saber Khalifa beat Roman Weidenfeller to a free-kick and headed against the crossbar, with Diawara nodding in the rebound.
When Payet was dismissed, Dortmund had 56 minutes to find a winner against 10 men.
Marco Reus hit the post as Klopp's side piled men forward, and the winner did eventually come as Marseille goalkeeper Steve Mandanda failed to keep out Grosskreutz's mishit effort from 15 yards.
- 4Michel MendesSubstituted forAbdallahat 45'minutes
- 29KhalifaSubstituted forMorelat 55'minutes
- 9GignacBooked at 71mins
- 14ThauvinSubstituted forImbulaat 79'minutes
- 17PayetBooked at 34mins
- 11J Ayew
- 5KehlSubstituted forPiszczekat 78'minutes
- 24SarrBooked at 90mins
- 16BlaszczykowskiSubstituted forHofmannat 66'minutes
- 11ReusSubstituted forSchieberat 78'minutes
- Marijo Strahonja
- Shots on Target
Second Half ends, Marseille 1, Borussia Dortmund 2.
Corner, Borussia Dortmund. Conceded by Benjamin Mendy.
Julian Schieber (Borussia Dortmund) wins a free kick in the defensive half.
Foul by Souleymane Diawara (Marseille).
Marian Sarr (Borussia Dortmund) is shown the yellow card for a bad foul.
Foul by Marian Sarr (Borussia Dortmund).
Gianelli Imbula (Marseille) wins a free kick in the attacking half.
Robert Lewandowski (Borussia Dortmund) wins a free kick on the right wing.
Foul by Benoit Cheyrou (Marseille).
Jonas Hofmann (Borussia Dortmund) wins a free kick on the right wing.
Foul by Jérémy Morel (Marseille).
Attempt missed. Jonas Hofmann (Borussia Dortmund) right footed shot from the centre of the box misses to the right. Assisted by Henrikh Mkhitaryan.
Foul by Lukasz Piszczek (Borussia Dortmund).
Benjamin Mendy (Marseille) wins a free kick on the left wing.
Goal! Marseille 1, Borussia Dortmund 2. Kevin Großkreutz (Borussia Dortmund) right footed shot from the centre of the box to the bottom left corner. Assisted by Julian Schieber.
Foul by Robert Lewandowski (Borussia Dortmund).
Steve Mandanda (Marseille) wins a free kick in the defensive half.
Corner, Borussia Dortmund. Conceded by Kassim Abdallah.
Substitution, Marseille. Gianelli Imbula replaces Florian Thauvin.