Deservedly losing 3-1 in the 69th minute and having lost Federico Chiesa to injury in the first half, Juve were leading eight minutes later and held on to a thrilling victory to stay three points behind Atalanta, who sit fourth in the final Champions League spot and hammered Covid-hit Udinese 6-2.
The win was all the more remarkable as soon after Mattia De Sciglio had lashed Juve ahead in front of a stunned Stadio Olimpico in Rome, Wojciech Szczesny saved Lorenzo Pellegrini's penalty.
That was a disappointing end to the match for Italy midfielder Pellegrini, who had lapped up the roar of the home crowd eight minutes after the break when his sumptuous free-kick looked to have given Roma the third goal they needed to seal what would have been Jose Mourinho's biggest win to date as coach.
However after Manuel Locatelli cut the deficit with a free header with 20 minutes left, Roma collapsed, letting Dejan Kulusevski sweep in a leveller two minutes later which was confirmed after a lengthy VAR check for offside.
De Sciglio's strike left the previously buoyant home support stunned and after Pellegrini fluffed his spot-kick they knew the game was up, despite Juve's Matthijs de Ligt being sent off for handball after giving away the missed penalty.
Roma sit eighth, level on 32 points with Fiorentina and Lazio and nine behind Atalanta after a crushing blow in what as already been a disappointing campaign.