Juventus qualified for the knockout stage of the Champions League with a comfortable 2-1 win over Lokomotiv Moscow on Wednesday.

Cristiano Ronaldo looked to have given Juventus an early lead after his free-kick was missed by Lokomotiv goalkeeper Guilherme Marinato but as the ball began to dribble over the line, Juve midfielder Aaron Ramsey poked it into the net. While he was just making sure the ball crossed the bar line, he ended up nabbing Ronaldo's goal.

Had the goal gone to Ronaldo's account, the former Real Madrid star would have set a new Champions League record by scoring against a 34th different club. It also would have been Ronaldo's first goal from a set-piece for Juventus since he joined them last season.

Meanwhile, it was Ramsey's first Champions League goal for the Serie A club.

"I thought the keeper was a lot closer to me and had a chance of diving back and maybe clearing it. My instinct took over to make sure that it went over the line. I've apologized to Cristiano," Ramsey said after Juventus' win at the Lokomotiv Stadium.

Later on in the match, Ronaldo was substituted at the 82nd minute and the legendary forward evidently looked unhappy. However, Juve boss Maurizio Sarri explained that Ronaldo was not upset with his substitution but the niggle in his knee was the real problem.

"Cristiano Ronaldo was angry because he's not ok. He's had a niggle in his knee for the past few days, which is overloading his thigh, which tires out too much. At the break, he was already worried about it. Then, when I saw him make a movement I didn't like when he was accelerating I took him off because I was scared that he might do himself real harm," Sarri told media after the match.

Paulo Dybala (L) scored two late goals as Juventus came from behind to beat Lokomotiv Moscow 2-1 in Turin
Paulo Dybala (L) scored two late goals as Juventus came from behind to beat Lokomotiv Moscow 2-1 in Turin AFP / Miguel MEDINA

After Ramsey scored at the third minute from kick-off, Aleksei Miranchuk equalized for Lokomotiv nine minutes later. The scoreline remained 1-1 at half-time. Juve's substitution at the 70th minute turned tables around as that brought Douglas Costa to the field.

Courtesy of the Brazilian's individual brilliance, Juventus clinched the victory in the end. Costa cut past three defenders, played a one-two with Gonzalo Higuain, dodged pass two more Lokomotive men before the midfielder netted the winner through the goalkeeper's legs.

Costa's goal ensured Juventus qualified to Champions League's Round of 16 from Group D with two games to spare.