Manchester City failed to secure a place in the Europa League as a 1-0 defeat at Borussia Dortmund saw them finish at the foot of Group D.
Julian Schieber scored the only goal of the game early in the second period, tapping home at the back post, to conclude a dismal campaign for Roberto Mancini's men.
Dortmund's win meant Real Madrid could only finish second in Group D, regardless of their 4-1 victory over Ajax at the Bernabeu.
Goals from Cristiano Ronaldo, Jose Callejon (2) and Kaka eased some of the negative tension currently surrounding Jose Mourinho, whose side are well off the pace in La Liga.
Madrid were fast into their stride on home soil, with Karim Benzema finding the net after six minutes, only to see his effort chalked off for offside following good work between Ronaldo and Kaka. Moments later Ajax enjoyed another let-off when Fabio Coentrao hit a post from Luka Modric's pass.
Modric's next involvement did lead to a goal as he released Benzema, who squared for Ronaldo to score after 13 minutes. Madrid then doubled their advantage through a brilliantly taken outside-of-the-boot strike from Callejon, again from Modric's assist.
Kaka soon made it three with another sweet finish, before Derk Boerrigter netted a consolation for Ajax. The final say came from Callejon, who completed the scoring in the dying minutes.
Arsenal finished second in Group B and face a potentially tougher last-16 draw after they were beaten 2-1 by Olympiakos in Greece.
The Gunners could have finished top had they won and Schalke failed to match their result at Montpellier, but that scenario failed to materialise.
Arsene Wenger left out plenty of his established names, making seven changes from the side that lost to Swansea at the weekend, with Jack Wilshere, Olivier Giroud and Lukas Podolski all missing as youngster Jernade Meade came in at left-back.
Arsenal's first clear opening fell the way of Aaron Ramsey, who failed miserably when he kicked against his standing leg from 12 yards. Marouane Chamakh was then released behind the Olympiakos defence but he too made a poor attempt to round the home goalkeeper.
Tomas Rosicky eventually handed the Gunners a lead with a sweeping finish seven minutes before the break, but Olympiakos hit back through Giannis Maniatis and Kostas Mitroglou.
Schalke completed an impressive group stage campaign by staying undefeated at Montpellier, drawing 1-1 in France. Benedikt Howedes and Emanuel Herrera exchanged goals just before the hour mark as the Germans advanced to the knockout phase in first place with three wins and three draws from their six games.
In Group A, Paris Saint-Germain will head into the last-16 draw as group winners after they beat Porto 2-1 in Paris. Porto needed to avoid defeat to top the group, but they failed due to goals from Thiago Silva and Ezequiel Lavazzi.
Dynamo Kiev had already sealed the Europa League place, so little was riding on their 1-1 draw with Dinamo Zagreb. Andriy Yarmolenko scored the opener, but Zagreb pegged them back through a 90th-minute Ivan Krstanovic penalty in a match that was heavily disrupted by snow.
The only issue to settle in Group C was destination of the Europa League place, taken by Zenit St Petersburg, who beat AC Milan 1-0 courtesy of Danny's strike. Milan were already guaranteed second spot, but Zenit led Anderlecht only by virtue of goal difference in the race for third.
Anderlecht could not apply pressure to their rivals as they drew with group winners Malaga 2-2 at La Rosaleda. Two goals from Sergio Duda ensured Malaga headed into the last-16 with 12 points from six games.