Real Madrid will go through as group winners to the Champions League last 16 after Toni Kroos and Marco Asensio each scored in a 2-0 win over Inter Milan on Tuesday.
A comfortable victory at the Santiago Bernabeu, aided by Nicolo Barella's red card in the 64th minute when Inter were one goal down, sent Madrid through top of Group D, five points ahead of the Italians, who advance as runners-up.
Inter had to win to claim first place but after weathering an early storm, Madrid were superior and Kroos' goal put them in control before Barella's sending off and then a superb strike from Asensio made the result secure.
Madrid's reward is a guarantee they will avoid the likes of Liverpool, Bayern Munich and Manchester City when the draw for the knock-out stages is made on Monday, although Lionel Messi's Paris Saint-Germain will be among those in the runners-up pot.
"We wanted to finish first in the group to avoid the stronger teams and we've done that," said Luka Modric.
Other than the shock defeat away at Sheriff in September, Madrid's group stage has been relative plain-sailing, with five wins, including two victories over Inter.
But the challenge now for Carlo Ancelotti's team will be to show they can still mix it with the very best in the latter stages, after they were outplayed last season by Chelsea in the semifinals.
Karim Benzema was absent after picking up an injury against Real Sociedad on Saturday and while Luka Jovic filled in, Madrid will hope to have Benzema back for the derby at home to Atletico Madrid in LaLiga on Sunday.
"We have a few days to see if Karim recovers, I think he will," said Ancelotti.