Robert Lewandowski scored twice as Bayern Munich came from behind to beat PSV Eindhoven 2-1 at Philips Stadion and secure their place in the knockout stages of the Champions League.
With Group D leaders Atletico Madrid beating Rostov 2-1 with a late goal, the Bundesliga side were guaranteed to finish in the top two.
Defeat, though, ends PSV's hopes of qualifying for the last 16 and the Dutch side must now battle it out for a place in the Europa League.
Santiago Arias had given the hosts the lead against the run of play on 14 minutes, before Lewandowski, who had previously hit the woodwork twice, levelled from the spot after 34 minutes.
Lewandowski got his second from close range on 74 minutes and was then denied a hat trick during the closing stages after his rising shot came back off the underside of the bar.
Bayern, who had beaten PSV 4-1 in the reverse fixture last month, made a strong start as Lewandowski saw his glancing header come back off the crossbar before the Polish frontman put the rebound over.
Dutch winger Arjen Robben, playing against the club he had joined as an 18-year-old in 2002, remained a threat down the right and sent a curling shot over.
Against the run of play, it was PSV who took the lead on 14 minutes.
The hosts broke quickly down the right flank and the ball was floated across the Bayern penalty area.
Davy Propper sent it towards goal with a diving header, which Manuel Neuer beat away with a brilliant reaction save only for Arias to nod the rebound down into the ground at the near post, the ball bouncing up over the keeper into the net.
Bayern were soon back on the offensive as Xabi Alonso tested PSV goalkeeper Remko Pasveer, who was making his Champions League debut in place of the injured Jeroen Zoet.
The 38-year-old former Heracles Almelo stopper then made a fingertip save to push a header from Robben around the post before from the resulting corner Lewandowski saw his header come back off the post.
On 34 minutes, the Germans were level.
PSV midfielder Andres Guardado was penalised for handball and Lewandowski made no mistake from the spot as he sent Pasveer the wrong way with a low shot into the bottom right corner.
Bayern continued their offensive at the start of the second half, as Pasveer tipped over a long-range effort from defender David Alaba.
PSV had won both of their Eredivisie matches since losing to Bayern and were able to restrict the Germans as the hour mark passed.
Robben made way for Douglas Costa and was applauded as he left the pitch by the Philips Stadion faithful.
The Brazilian had an instant impact as he helped set up Bayern's second goal on 74 minutes. Costa cut back inside from the left and then played a clever ball out to Alaba.
The Austrian drilled a low cross through the six-yard box, where Lewandowski arrived ahead of his marker to guide the ball past Pasveer.
With five minutes to go, the Polish forward was unfortunate not to score a third.
Lewandowski collected a pass from Costa inside the penalty area before flicking the ball up over marker Daniel Schwaab and then crashing his shot past Pasveer only to see it come back off the underside of the woodwork and bounce clear.