FRANKFURT, Germany (AP) -- Real Madrid and AC Milan, with 16 Champions League titles between them, advanced to the knockout stage on Wednesday, along with Borussia Dortmund and Schalke to make it three out of three teams from Germany.
Nine-time champion Madrid held on for 1-1 at Manchester City with 10 men, eliminating the English Premier League champion in the process. Also in Group D, Dortmund beat Ajax 4-1 to go through as the top team.
Seven-time winner Milan got a spectacular overhead goal from defender Philippe Mexes as it went through with a 3-1 win at 10-man Anderlecht. Malaga drew 2-2 at Zenit St. Petersburg to win Group C.
Schalke defeated Olympiakos 1-0 and Arsenal beat Montpellier 2-0 to progress out of Group B.
Paris Saint-Germain won 2-0 at Dynamo Kiev to go through from Group A with FC Porto, which beat Dinamo Zagreb 3-0. Zagreb still hasn't scored a goal, let alone earned a point.
On Tuesday, Bayern Munich, Barcelona, Shakhtar Donetsk and Valencia also reached the knockout stage, while Chelsea was on the verge of becoming the first titleholder to fail to make it out of the group stage.
Chelsea's 3-0 loss at Juventus cost Roberto Di Matteo his job as coach despite leading the London club to the title in May. Rafa Benitez, who won the 2005 title with Liverpool, was hired to replace him in an interim role.
The goal of the day belonged to Mexes against Anderlecht.
Receiving a free kick outside the box with his back to goal, Mexes sent a perfectly executed overhead kick from 20 meters out that dipped over goalkeeper Silvio Proto and into the far corner.
The goal resembled the fourth strike by Zlatan Ibrahimovic against England last week. Ibrahimovic failed to score on Wednesday, but Ezequiel Lavezzi notched a double as Paris Saint-Germain cruised in Kiev.
Germany forward Lukas Podolski also had an eye-catching goal in Arsenal's win over Montpellier that also featured Jack Wilshere's first strike in two years. The Gunners advanced from the group stage for the 13th straight year.
Podolski met Olivier Giroud's floated pass with a powerful first-time strike from the edge of the area in the 63rd.
Assured of a top-two finish, Arsenal will go into its last Group B game at Olympiakos a point behind Schalke. Both sides will want to finish top to secure what would likely be an easier last-16 match.
"That's 13 times in a row -- it's not the most glamorous thing but it's the most difficult, being consistent at this level," said Arsenal coach Arsene Wenger, whose team has gone on to reach the final only in 2006 when it lost 2-1 to Barcelona.
Manchester City's campaign ended in the group stage for the second successive season. City needed a win to keep its hopes alive, but Karim Benzema exploited sloppy defending to put Madrid ahead after just 10 minutes at Etihad Stadium.
City secured a lifeline in the 74th when Alvaro Arbeloa was sent off for fouling Sergio Aguero, who subsequently equalized from the penalty spot.
But in Jose Mourinho's 100th match managing in the Champions League, Madrid held on for the draw to qualify behind leader Borussia Dortmund with a game to spare.
"The only two times I finished second in the group, I won the Champions League," said Mourinho, who won the competition with FC Porto and Inter Milan. "It means something (to finish top), but my experience is, it doesn't mean so much."
City was at the bottom with just three points from five matches.
"With the array of players at their disposal it is amazing they have been eliminated at the group stage two years running," Mourinho said.
Young Italy forward Stephan El Shaarawy scored one goal and set up Alexandre Pato in injury time as Milan beat Anderlecht. Milan is compensating for its struggles in the Serie A.
Dortmund, which failed to advance from the group stage last season, extended its impressive run, with Germany midfielder Mario Goetze involved in all four goals, including two by Robert Lewandowski.
Dortmund, the 1997 champion, sealed the win before halftime at Amsterdam Arena thanks to its clinical finishing on the break and Goetze's skill and vision.
Ajax captain Siem de Jong was impressed.
"In the first half they were only in front of goal three times and they scored three goals. They were so effective," De Jong said.
Schalke left it late to secure its win, with defender Christian Fuchs driving home from long range with 13 minutes remaining.
"When you get such a chance you have to take it with both hands," Fuchs said.