A late Cristiano Ronaldo double gave Juventus a 2-1 win over Udinese in Serie A on Sunday which boosted their hopes of qualifying for next season's Champions League.
Udinese went into the break ahead when Juve's defence switched off after a free-kick was awarded and Nahuel Molina's low shot found its way beyond Wojciech Szczesny.
Juventus fleetingly showed moments of quality but equalised with an 83rd-minute spot-kick from Ronaldo, awarded after the Portugal forward's free-kick moments earlier struck the arm of Rodrigo de Paul.
Ronaldo added a second with one minute left when he headed in Adrien Rabiot's cross at the back post to secure a dramatic late win for Andrea Pirlo, who raced down the touchline to celebrate with Juve's players.
Udinese gave early warning of their threat when Jens Stryger Larsen's shot from distance forced a save out of Szczesny.
The home side took the lead with a quick free-kick which caught Juve off guard as De Paul slipped in Molina and Szczesny could not keep out his powerful angled shot.
An unmarked Weston McKennie headed wide from a good position just before the half hour while Paulo Dybala's deflected shot brought a diving save from Simone Scuffet as Juventus briefly sparked into life.
Ronaldo was largely subdued in the first half with a glancing header over the crossbar his only chance of note.
Tolgay Arslan fired wide from a good position early in the second half and Stryger Larsen saw a curling effort flash past the post as Udinese went in search of a second.
However, Juve were awarded a penalty seven minutes from time when De Paul, stationed at the end of the wall, inexplicably stuck out an arm to block Ronaldo's free-kick.
Ronaldo buried the spot-kick and then completed the turnaround six minutes later, arriving to nod in substitute Rabiot's superb ball to the back post.
What does it mean? Juve not out of the woods yet
This result was a huge let off for under-pressure Pirlo as Ronaldo spared his blushes and condemned Udinese to a fourth straight home defeat.
Juventus have won seven of their last eight Serie A games against Udinese but this was arguably their most significant as they climbed up to third spot. They are now level on points with Atalanta and Milan and two points above fifth-placed Napoli.
However, with games against Milan and new champions Inter to come before the Coppa Italia final, Pirlo and his Juve players still have little margin for error to secure Champions League football next season.
Ronaldo ends drought
Juventus forward Ronaldo had not scored in his last three Serie A appearances, which was his longest goal drought since he went four games without scoring in November 2017 for Real Madrid.
He roared back into form at a key time for Juve as he showed again his value to the Bianconeri with his 26th and 27th league goals of the season.
Daft from De Paul
After his assist De Paul has been directly involved in 16 goals in Serie A this season (eight goals and eight assists) and has only fared better in 2018-19 (17 - nine goals and eight assists).
He also made more successful passes (58) than any other Udinese player against Juve, but all his good work was undone by a moment of madness as he needlessly handled and gave away a penalty.
Juventus host fellow top-four rivals Milan in Serie A next Sunday while 11th-placed Udinese have another home game on Saturday with Bologna the visitors.