Alvaro Morata grabbed a late winner with Cristiano Ronaldo also scoring as Juventus qualified for the Champions League last 16 with a 2-1 win over Ferencvaros on Tuesday.
Myrto Uzuni had given the Hungarians a shock 19th-minute lead in the Group G clash in Turin.
But Ronaldo rifled in the equaliser on 35 minutes for his first Champions League goal this season, extending his record to 131 goals in the competition.
And Spaniard Morata came off the bench to seal victory two minutes into injury time with his fifth group-stage goal this term.
Andrea Pirlo has achieved his first objective as Juventus coach having taken over from Maurizio Sarri after the Italians crashed out of the Champions League in the last 16 to Lyon last season.
Ferencvaros pushed the Italian champions hard as they chased their first group-stage win since 1995, having lost the home encounter 4-1 in Budapest.
Giorgio Chiellini and Leonardo Bonucci were out injured with the Juventus defence made up of Danilo, Matthijs de Ligt, Alex Sandro and Juan Cuadrado.
Paulo Dybala, wearing the captain's armband, started up front alongside Ronaldo.
Ronaldo set up the Argentine for the first shot on goal after quarter of an hour, but goalkeeper Denes Dibusz blocked the close-range effort.
And it was the visitors who broke through four minutes later, with Uzuni turning in Tokmac Nguen's deflected cross.
Ronaldo had a goal ruled out for offside on 33 minutes but moments later he made no mistake, creating space with a neat turn outside the area before drilling home a powerful left-footed shot that gave Dibusz no chance.
The Portuguese, who missed the first two European games this season with coronavirus, brought his tally to 70 Champions League goals at home, level with Barcelona star Lionel Messi.
He was denied a second before the hour mark, with Federico Bernardeschi also going close just after, rattling the woodwork.
Pirlo made a triple substitution after the hour with Morata, Federico Chiesa and Dejan Kulusevski coming on place of Dybala, Bernardeschi and Weston McKennie.
Morata had an immediate impact, sending the ball through for Ronaldo but Dibusz held firm.
The Spaniard missed a chance 10 minutes from time, hitting the woodwork after meeting Chiesa's cross.
But the former Atletico Madrid striker got his head to a Juan Cuadrado cross, with the ball slipping in under Dibusz.