Juventus' Brazilian forward Douglas Costa celebrates with Juventus' Argentine forward Paulo Dybala after scoring a goal during the UEFA Champions League group D football match between FC Lokomotiv Moscow and Juventus at Moscow's RZD Arena stadium
The Old Lady knew that a win would clinch their spot in the knockout stage with two games to spare and they got off to a perfect start on three minutes with what was their 300th goal in the competition.
Cristiano Ronaldo's speculative left-wing free kick somehow squirmed through goalkeeper, Marinato Guilherme's legs, allowing Aaron Ramsey to make completely sure on the line.
The home side swiftly responded and were level on 12 minutes when Aleksey Miranchuk fired in after his initial header had come back off the post.
Ronaldo and Gonzalo Higuain came closest to restoring the away side's advantage, but Guilherme went some way to redeeming himself with a string of smart saves. Leonardo Bonucci then cleared off the line to stop Lokomotiv sneaking in front prior to Costa's heroics at the other end.
The dramatic late triumph means the Bianconeri remain unbeaten under Maurizio Sarri so far this season and sees them move top of Group D on 10 points, ahead of Atletico Madrid's trip to pointless Leverkusen. Lokomotiv remain third on three points and are all-but out.
It's a team game - but Ronaldo will surely want that opening goal. It was an end to end, entertaining affair but Juventus' strong finish was too much for the tiring Lokomotiv defence at the death. The joy of qualification will make the Ramsey-Ronaldo conversation much more light-hearted now. CR7's ruthless, unquenchable thirst for goals may mean he ends up putting in a firm bid to claim that opener, despite Ramsey making sure as the ball trickled towards the line. The Welshman is still waiting for his Juventus career to take off, but it's doubtful he'll bother going up against Ronaldo if the Portuguese star insists on taking credit. There will be lots of talk about the result is all that matters, but when greatness and goal records are at stake, expect actions to speak a bit louder than words - if they can, and UEFA don't insist Ramsey's first CL start for the Bianconeri is capped by him getting on the scoresheet. Watch this space.
MAN OF THE MATCH
Leonardo Bonucci (Juventus). Solid at the back as usual. It could easily go to Costa for his match-winning contribution, but over the course of the entire game Bonucci was impressive. The Italian defender also made a key contribution when he brilliantly cleared off the line at 1-1.
3' - GOAL! Lokomotiv 0-1 Juventus. Ronaldo drives a low, left-wing free kick straight at Marinato Guilherme, who somehow allows it to squirm out of his clutches. Ramsey made sure as it tricked over the line.
12' - GOAL! Lokomotiv 1-1 Juventus. Lokomotiv are level! Aleksey Miranchuk meets Joao Mario's cross with a lovely header. It comes back off the far post, but the forward is alert to gobble up the rebound.
22' - LOKOMOTIV CHANCE. Zhemaletdinov clips a lovely ball into the middle for Miranchuk who can't keep his glancing header from close-range down. Big chance wasted.
34' - JUVENTUS CHANCE. Guilherme produces a super stop down by his left post after Higuain had met Khedira's delicious pass with a first-time attempt.
57' - JUVENTUS CHANCE. Ronaldo thumps an effort towards the top corner, but Guilherme springs into action and tips it past his right-hand post.
77' - LOKOMOTIV CHANCE. Lokomotiv break at speed. Szczesny makes a brilliant save before Bonucci hacks off the line from Joao Mario's sizzling shot.
90+3' - GOAL! Lokomotiv 1-2 Juventus. Douglas Costa wins it for the Italians as he bursts into the box, exchanges a one-two and coolly slips the ball home.
Juventus's opener saw the Old Lady become the fifth team to reach a milestone 300th goal in the UEFA Champions League.
Ramsey is the first British player to score a goal for Juventus in a CL/European Cup match.
Juventus have been qualified to the Champions League Last 16 with at least two games to play for the first time since 2008/09.