Manchester United crashed out of the Champions League on Wednesday after a 3-2 defeat at Wolfsburg, as the Germans punched their ticket to the last 16 along with Group B rivals PSV Eindhoven.
Julian Draxler set up Vieirinha to round off a sublime team move and put Wolfsburg 2-1 ahead just before the half hour.
But United clawed their way back into the game eight minutes from time when Josuha Guilavogui headed into his own net.
Naldo, however, grabbed his second of the night shortly after as he headed home a corner to consign United to a third-place finish and a spot in the last 32 of the Europa League.
In the Netherlands, it had looked for a short time as if CSKA Moscow could spare United's blushes when Sergey Ignashevich converted a 76th-minute penalty to put CSKA 1-0 up against PSV.
But the Dutch side hit back just two minutes later through Luuk de Jong and completed the turnaround with five minutes to play as Davy Propper earned the home side a 2-1 victory, ensuring they went through as runners-up behind Wolfsburg.
Manchester City wrested away top spot from Juventus in Group D as Manuel Pellegrini's side claimed a thrilling 4-2 victory over Borussia Moenchengladbach, while last year's finalists succumbed to a 1-0 defeat at Sevilla.
David Silva had given Manuel Pellegrini's side a 16th-minute lead at Eastlands but Julian Korb levelled three minutes later before Raffael turned home before the break to put the Germans ahead.
But two quick-fire goals from England international Raheem Sterling put City back on track with Wilfried Bony sealing the win.
"It's brilliant [to top the group], we worked hard, we deserve it. The most important thing was trying to avoid the big teams and getting a fair draw," Sterling said.
In Seville, Fernando Llorente's 65th-minute goal guided the Spaniards past Juve and enabled them to pip Gladbach into third, ensuring Unai Emery's men will have a chance to land a third consecutive Europa League crown.
Cristiano Ronaldo smashed his own pool stage scoring record as he netted four times in a crushing 8-0 victory over Malmo in Group A.
The Portuguese star's tally of 11 goals in this season's group campaign surpassed the previous mark of nine set by himself in 2013/14 and Luiz Adriano for Shakhtar Donetsk last season.
Troubled French striker Karim Benzema also scored his first hat-trick for five years, while Mateo Kovacic added his first goal for the Spanish giants.
Paris Saint-Germain eased to a 2-0 victory at home to Shakhtar Donetsk with second-half goals from Lucas and Zlatan Ibrahimovic at the Parc des Princes.
Laurent Blanc's side were already guaranteed to finish second in the group behind Real, exposing the French champions to the possibility of facing European champions Barcelona or Bayern Munich when the draw for the last 16 is made next Monday at UEFA headquarters in Nyon.
Atletico Madrid wrapped up first place in Group C as they avenged an earlier home loss to Benfica with a 2-1 victory in Lisbon.
Saul Niguez's first-half strike put Diego Simeone's men in front before Luciano Vietto netted a second on 55 minutes, with Kostas Mitroglou grabbing a consolation for the hosts.
Galatasaray denied Astana a famous first group stage win and the chance to continue the team's continental adventure in the Europa League as Selcuk Inan cancelled out Patrick Twumasi's opener in a 1-1 draw in Turkey.