MUNICH (AP) — Bayern Munich squandered a two-goal lead as Manchester City ended the title-holder's record 10-match winning run in the Champions League with a 3-2 victory on Tuesday.

Both teams had already qualified for the knockout stages and both finished Group D on 15 points. Bayern took first place because of a better head-to-head record. Elsewhere in the group, Viktoria Plzen beat CSKA Moscow 2-1 to clinch a slot in the Europa League, while the Russian side was eliminated from European competition.

Bayern applied tremendous pressure from the start and was 2-0 up in the first 12 minutes.

Thomas Mueller scored in the fifth before Mario Goetze doubled the lead.

Bayern missed several good opportunities before City began its comeback with a goal from David Silva in the 28th minute.

Aleksandar Kolarov leveled with a penalty in the 59th and James Milner capitalized on a mistake by Bayern's defense to win it for City in the 62nd.

"It was a terrible start and we gave away some sloppy goals," Milner said. "But to go to a place like this and go 2-0 down and then come back and win shows the character in this dressing room."

It was City coach Manuel Pellegrini's first win against a side coached by Pep Guardiola in 10 attempts. It was also Bayern's first defeat of the season — apart from a 4-2 loss to Borussia Dortmund in the minor Super Cup in Germany. Pellegrini did not use star striker Sergio Aguero.

"We began very well but then we let them back in the match," Guardiola said. "The Champions League is tough and Manchester City is a very, very good team.

"Maybe it was good to lose, especially now, when it wasn't that important. Still we won the group," Guardiola said.

Bayern began in such a dominant fashion that City might have feared a rout in the making after conceding twice so early.

The German side, which won 3-1 in Manchester, went ahead when Mueller controlled a long ball from Dante and fired a low left-foot shot into the net.

Goetze knocked in the ball after City's defense failed to clear a corner from Toni Kroos and a subsequent shot from Mario Mandzukic.

Bayern kept up the pressure but appeared to slow down a gear before Silva pulled one back for City.

Jesus Navas crossed and Milner nodded it back across goal for Silva to stroke the ball home.

Bayern nearly increased the lead late in the first half when Mandzukic fed Mueller with a back-heel pass but former Bayer defender Martin Demichelis struck his foot out to block the attempt.

Dante gave away the penalty when he tripped Milner and captain Kolarov sent goalkeeper Manuel Neuer the wrong way to level the score.

Milner struck the winner after Jerome Boateng missed the ball while attempting a clearance and Milner curled the loose ball inside the far post.

A lethargic Dante nearly allowed Alvaro Negredo to increase the lead but Neuer managed to block the shot with his leg.