Douglas Costa sent Juventus through to the last 16 of the Champions League with a brilliant 93rd-minute winner in a 2-1 away victory over Lokomotiv Moscow.
The Bianconeri were ahead after just three minutes when Aaron Ramsey nudged the ball over the line after goalkeeper Guilherme had spilled Cristiano Ronaldo's free-kick back towards his goal.
However, Lokomotiv soon hit back through Aleksey Miranchuk and Guilherme denied Ronaldo twice in the second half as the Portuguese attempted to set a Champions League record by scoring against a 34th different team.
It was not to be Ronaldo's night as he was replaced with nine minutes to go, yet Costa stepped up to be the hero, weaving in off the left wing and finishing after a one-two with Gonzalo Higuain.
Ronaldo had eight shots without finding the net in the previous meeting between the two clubs, but his first effort here led to the opener, even though he was not the scorer.
His free-kick from the left should have been easily gathered by Guilherme, yet the goalkeeper spilled the ball down onto his left leg and it rolled towards goal, with Ramsey nudging home just as the ball appeared to be creeping over the line anyway.
Juve's lead lasted just nine minutes, though, as the host levelled through Miranchuk, who followed up to place home after initially heading Maciej Rybus' cross against a post.
Miranchuk headed a cross from the other flank just over before Guilherme redeemed himself somewhat with a smart one-handed stop to deny Higuain's volley.
The keeper managed to push Ronaldo's first free-kick of the second half away from his goal, rather than back towards it, and the forward was denied again by another fine save from his vicious strike.
Wojciech Szczesny was required to save from Grzegorz Krychowiak at the other end, with Leonardo Bonucci clearing the follow-up from Joao Mario off the line.
Ronaldo was substituted as Juve toiled in the second half, but Costa delivered some magic with the winner, slaloming past desperate Lokomotiv tackles and slotting through Guilherme's legs after collecting a return pass from Higuain.
What does it mean? Sarri can count on Costa
With time ticking away in the second half and Ronaldo already substituted, Maurizio Sarri needed a different match-winner to step forward.
It was Costa, a man blighted by injuries in 2019, who came up with his first goal since January. Moreover, the manner in which he delivered the winner – with brilliant close control and a fine finish – will have excited Sarri. Now if he can just stay fit...
Ramsey starting to find his feet
An injury-hit start to the season has stunted former Arsenal midfielder Ramsey's progress at Juventus too, but he displayed promise in his 64 minutes on the pitch.
Okay, he will not get an easier goal in his time with the Bianconeri, but Ramsey also provided two key passes and Sarri's side appeared to run out of ideas when he went off, until Costa conjured up his winner.
Ronaldo runs out of steam against Lokomotiv, again
Had Ramsey not displayed a poacher's instinct, Ronaldo may have broken the Champions League record he jointly holds with Raul and Lionel Messi.
Yet, two weeks after failing to score against Lokomotiv, Ronaldo was frustrated once more. He had eight shots again in Moscow, only three of which were on target, and there was an air of desperation, perhaps understandable given the circumstances.
Key Opta Stats:
- Juventus qualified for the Champions League last 16 with at least two games to spare for the first time since 2008-09.
- Ramsey's goal was Juventus' 300th in the Champions League - the fifth club to reach this total after Real Madrid, Barcelona, Bayern Munich and Manchester United.
- Costa has scored his first goal for Juventus in Champions League, his last was in March 2017 for Bayern Munich against Arsenal.
- Miranchuk is the first player to score home and away during the group stages of a Champions League campaign against Juventus since Ronaldo back in 2013-14.
- Ronaldo has been subbed off in a Champions League match for the first time since October 2016 (v Roma).
Juventus host out-of-form AC Milan in Serie A on Saturday and entertain Atletico Madrid in their penultimate Champions League group game later this month. Lokomotiv return to domestic action against Krasnodar and their Champions League last-16 hopes could already be extinguished by the time they face Bayer Leverkusen.