Gareth Bale and Lucas Vazquez earned Real Madrid a 2-0 win away to Roma that guarantees the Champions League holders first place in Group G.
Both teams had already qualified thanks to a draw between CSKA Moscow and Viktoria Plzen earlier in the day, but top spot - and potentially an easier draw in the first knockout round - was up for grabs.
Cengiz Under produced a contender for the worst miss of the season late in Tuesday's first half, the Roma forward blasting a dreadful effort over the crossbar from close range.
Bale's third Champions League goal of the season nudged Madrid in front in an engrossing contest at the Stadio Olimpico, profiting on an error from Federico Fazio, with Vazquez then tapping in the decisive second.
The 1-1 draw in Moscow meant both sides were assured of progress, with the game enjoying a high-tempo start as a result.
Luka Modric's shot was blocked and Raphael Varane made a last-ditch clearance to keep Madrid level, while a ferocious Aleksandar Kolarov long-range drive flew just wide of the post.
Under should have put Roma ahead just before the break but he somehow planted his finish from Nicolo Zaniolo's low cross well over the crossbar from inside the six-yard box.
And that dreadful miss was punished 61 seconds into the second half by Bale.
Fazio's backpass was sliced high by Robin Olsen, with the defender's attempted header back to the goalkeeper seized upon by the Wales star, who drilled into the bottom-left corner.
Bale should have added a second moments later after racing through but he fired straight at Olsen, but Vazquez's first goal since March wrapped up the points for Madrid.
A fine team move from Santiago Solari's side ended with Karim Benzema nodding the ball into the path of Vazquez for a simple finish, with Olsen making a string of saves to keep the scoreline respectable.
What does it mean? Pressure mounts on Di Francesco
The Moscow result boosted under-fire Roma coach Eusebio Di Francesco with reports in Italy suggesting he had been given two matches to save his job. Roma, beaten 1-0 at Udinese last time out, produced an enterprising performance but Madrid's finishing was more clinical. Solari's men also lost at the weekend, going down 3-0 at Eibar in his first game as permanent head coach, but this was much more like their fluid best.
Varane starting to find form
Madrid had not won any of their last seven matches in which Varane had played, losing six of them, but he gave an assured display at the back. One clearance in the first half was miraculous and though Roma's rapid attackers caused Madrid problems in defence, the World Cup winner was solid.
Under miss painful for Roma
The hosts had won seven home Champions League games in a row and last season's semi-finalists might have made it eight had Under converted an easy first-half chance. How the 21-year-old managed to miss from around five yards out will remain a mystery.
Real Madrid host Valencia in LaLiga on Saturday, with Roma welcoming Inter to the Stadio Olimpico a day later in Serie A. Madrid host CSKA on matchday six with Roma at Viktoria Plzen.