Juventus progressed to the Champions League last 16 after a Cristiano Ronaldo goal and a late header from substitute Alvaro Morata gave them a comeback 2-1 home win over Hungarians Ferencvaros on Tuesday.
With two games remaining, the result left Juve second in Group G on nine points from four matches, three behind leaders Barcelona who also booked a knockout-stage berth with a 4-0 win at Dynamo Kyiv.
Ferencvaros and Dynamo are level on one point and will vie for the consolation prize of joining the Europa League round of 32 after the winter break.
Juventus coach Andrea Pirlo said a tactical switch to attacking down the flanks instead of through the middle paid off in the second half.
“I think we were better in the second half, tactically,” said the former Italy midfielder.
“Sometimes we tried too often to break through the middle while we should have played more on the flanks. It was important to win and qualify, we tried until the end and this is what I liked the most.”
The Italian champions made heavy weather of the clash against Ferencvaros after beating them 4-1 in the reverse fixture, and they often looked lethargic against a packed visiting defence.
Paolo Dybala missed their best chance in the first half when goalkeeper Denes Dibusz blocked his close-range shot in the 15th minute and the home side were punished four minutes later by a quality goal.
Myrto Uzuni fired Ferencvaros ahead with a delightful touch which beat home keeper Wojciech Szczesny after Tokmac Nguen had shaken off two markers and clipped a perfectly weighed cross into the heart of the penalty area.
Ronaldo, who barely featured in the opening half-hour, had a goal correctly ruled out for offside before he equalised in the 35th minute with a sweet, left-foot shot from 20 metres which fizzed into the back of the net inside the near post.
Juventus pressed in the second half but it looked like they would have to settle for a draw and leave themselves with work to do in order to qualify after Federico Bernardeschi and Morata hit the woodwork.
However, a valiant performance by the visitors was undone in stoppage time as Morata’s downward header from eight metres squeezed under Dibusz’s body and over the line after a fine cross from the right by Juan Cuadrado.