Substitute Douglas Costa scored an exquisite stoppage-time goal to give Juventus a 2-1 win away to Lokomotiv Moscow on Wednesday (Nov 6), which clinched their place in the Champions League round of 16 with two games to spare.
Juventus sealed their place in the last 16 of the Champions League with an injury-time winner against Lokomotiv Moscow in Group D. Substitute Douglas Costa struck the decisive blow with a cool finish as the visitors rallied late on.
Aaron Ramsey handed Juve an early lead after Guilherme spilled Cristiano Ronaldo's free-kick, before Aleksey Miranchuk equalised.
Juventus will be joined by Atletico Madrid if they beat Bayer Leverkusen.
Maurizio Sarri made seven changes to his side that won the Turin derby last weekend, handing Ramsey a first European start for the club, and the Juve boss was rewarded early on.
Guilherme allowed Ronaldo's long-range free-kick to bounce and trickle through his legs, and the Welshman tapped his side's 300th Champions League goal into an empty net.
Lokomotiv, who knew victory would have kept their qualification hopes in their own hands, responded after going behind and Miranchuk scored his second goal in as many games against the Italian giants to level.
The forward headed against the post to beat the diving Wojciech Szczesny before converting the loose ball into an empty net.
Ronaldo - who was denied breaking the record for scoring against the most clubs in the Champions League by Ramsey's final touch in the first half - improved after the break.
The Portuguese forward forced Guilherme into a terrific save from a fierce shot as Juve pushed forward, while Leonardo Bonucci had to be sharp to clear Joao Mario's shot off the line at the other end, as the hosts threatened to snatch the winner against the run of play.
Qualification was secured when Costa finished off Gonzalo Higuain's through ball to send his side into the knockout stages, with two group games to play.