Cristiano Ronaldo scored his 61st goal of 2012 as Real Madrid thrashed Ajax 4-1 at the Bernabeu.
The former Manchester United forward, 27, opened the scoring from Karim Benzema's cross before Jose Maria Callejon doubled the lead.
Kaka then rolled back the years to curl a brilliant third in off the post before Derk Boerrigter pulled one back.
Callejon wrapped up the win late on as Real finished second to Borussia Dortmund in Group D.
Who has qualified?
- Group A:
- Group B:
- Group C:
Malaga, AC Milan
- Group D:
Dortmund, Real Madrid
- Group E:
- Group F:
Bayern Munich, Valencia
- Group G:
- Group H:
Ronaldo has now scored 167 goals in 165 games for Real since joining in 2009, but his achievements in 2012 have been eclipsed by Barcelona's Lionel Messi, who can match Gerd Mueller's record of 85 goals in a calendar year if he scores against Benfica on Wednesday.
Elsewhere, Paris Saint-Germain took top spot in
after Ezequiel Lavezzi took advantage of poor goalkeeping to seal a 2-1 win at home to Porto.
Thiago Silva headed PSG ahead before Jackson Martinez equalised, but Lavezzi sealed the group for Carlo Ancelotti's side when his weak shot was fumbled in by Porto goalkeeper Helton. Porto had already qualified and go through in second place.
In a match temporarily suspended due to heavy snow, Dinamo Zagreb claimed their first and only point in Group A when Ivan Krstanovic hit an injury-time penalty to draw 1-1 at home to Dynamo Kiev.
, a goal by Danny gave Zenit St Petersburg a surprise 1-0 win over runners-up Milan at the San Siro to secure a Europa League spot.