GENEVA (AP) -- In a dramatic climax to one of the tightest groups in Champions League history, Borussia Dortmund needed an 87th-minute goal at Marseille to advance at the expense of Napoli which beat Arsenal.
Dortmund, last season's beaten finalist, was on the brink of elimination and missed a series of chances against the 10-man French side until Kevin Grosskreutz scored to clinch a 2-1 win.
Instead, Dortmund won the group ahead of Arsenal, which lost 2-0 to Napoli as all three teams finished on 12 points and head-to-head tiebreakers sent the Italians out.
"What a feeling! We were almost out of the competition. This is great. We deserved it. And I didn't even hit the ball right," said Grosskreutz, who was born and raised in Dortmund.
On a tense day for Italian clubs, AC Milan advanced by clinging on for a 0-0 draw at home to Ajax after captain Riccardo Montolivo was sent off in the 22nd minute.
Juventus exited in the afternoon after Wesley Sneijder scored late for Galatasaray to win 1-0 in atrocious weather and pitch conditions in Istanbul. The match had resumed after being abandoned in snow and hail on Tuesday evening.
Barcelona's progress was smooth and easy as Neymar scored three in a 6-1 rout of Celtic, ensuring the Spanish champion won Group H ahead of Milan to be seeded in the draw on Monday.
Schalke beat Basel 2-0 to finish runner-up behind Group E winner Chelsea, which beat last-placed Steaua Bucharest 1-0.
Germany will have four teams in the last-16 draw for the first time, and England also has its full quartet remaining. Italy has only Milan, confirming the recent slump of Serie A clubs in Europe's top competition.
Zenit St. Petersburg advanced with the worst record, stuck on just six points -- six fewer than Napoli -- after losing 4-1 at Austria Vienna.
However, third-placed Porto failed to take advantage, having a penalty saved in its 2-0 loss at Group G winner Atletico Madrid.
Dortmund's progress seemed under control when Polish forward Robert Lewandowski scored in the fourth minute against Marseille, which lost all its group matches.
Though Souleymane Diawara levelled with a header in the 14th, Marseille was soon reduced to 10 men when Dimitri Payet was shown a second yellow card for being adjudged to have dived in the Germans' penalty area.
Dortmund laid siege to the home goal in the second half but Lewandowski missed an open goal, putting his shot into side netting after rounding goalkeeper Steve Mandanda.
Marco Reus, who had earlier struck the post, shot over from six meters (yards) and Lewandowski was denied a penalty claim in the 85th when bundled to the ground by Mandanda.
When Grosskreutz scored, Napoli then led Arsenal through Gonzalo Higuain's 73rd-minute goal but needed to win by three goals. Despite Arsenal midfielder Mikel Arteta being sent off in the 75th, Napoli added only a second from Jose Callejon in stoppage time to complete one of the unluckiest group-stage exits since the Champions League format was created in 1992.
Milan put up a defensive barricade to fend off Ajax attacks after Montolivo was shown a straight red card for stamping on Christian Poulsen.
"It seems to me that anti-football won today," said Ajax coach Frank de Boer, who suggested that World Cup final referee Howard Webb should also have sent off Mario Balotelli in the second half.
Red cards decisions were a factor at Schalke where Basel needed only a draw to advance.
Basel defender Ivan Ivanov was sent off in the 31st, two minutes after Schalke captain Benedikt Howedes had been shown only a yellow card in a similar situation at the other end.
Schalke led in the 50th when Julian Draxler connected with a first-time shot from a right-flank cross, and Joel Matip exploited Basel's failed offside trap seven minutes later.
Brazil star Neymar had yet to score for Barcelona in the Champions League until adding a third first-half goal Wednesday, after strikes from Gerard Pique and Pedro Rodriguez. Cristian Tello got the sixth before Giorgos Samaras got last-placed Celtic's consolation.
Third-placed teams in the groups -- including former European champions Ajax, Juventus and Porto -- will transfer to the Europa League in that competition's last-32 draw on Monday. Juventus will host the final in May.
In the Champions League draw, seeded teams cannot play a team from their own country or the team it already played in the group.
Seeded teams: Manchester United, Real Madrid, Paris Saint-Germain, Bayern Munich, Chelsea, Borussia Dortmund, Atletico Madrid, Barcelona.
Non-seeded teams: Bayer Leverkusen, Galatasaray, Olympiakos, Manchester City, Schalke, Arsenal, Zenit St. Petersburg, AC Milan.