Juve saw their gap at the top of the league cut to one point when they lost to Napoli last weekend and they were heading for another shock defeat after Mauro Icardi’s effort and a Andrea Barzagli own-goal put Inter within touching distance of a fine win.
But Massimiliano Allegri’s men, who led early on through Douglas Costa, refused to give up and drew level in the 87th minute through a Milan Skriniar own-goal and then two minutes later won it thanks to Gonzalo Higuain’s header.
The three points, which have to be considered a bonus, mean they are now four ahead of Napoli, who play Fiorentina on Sunday.
Inter battled bravely, having been forced to play most of the game with 10 men after Matias Vecino was sent off after a challenge on Mario Mandzukic.
Juventus boss Massimiliano Allegri believes his side’s stunning late win at Inter could be a decisive result in the Serie A title race.
‘It was a wonderful evening of football between two teams who needed to win and went all out,’ Allegri told Sky Italia.
‘We were aggressive and played well throughout the first half, but we fell asleep in the locker room and ended up trailing.
‘Inter played well, but got tired in the end, crumbled physically and we took advantage. It’s another step towards the Scudetto, even if it remains very difficult.
‘Nothing is ever certain in football. I knew it would be tough and in the final four rounds there is always more pressure than when you play in September.
‘Even a side with great mental strength will have moments where they lose confidence. Fortunately, the lads have found it again and we turned it around.
‘It’ll make a big difference in the Scudetto race. It is very difficult to win at San Siro and the lads put in an extraordinary performance. We know that we’ve got to win them all.’
Inter boss Luciano Spalletti said on Italian television station Mediaset Premium: ‘Clearly, we need to shake off the bitterness of this defeat, because the team didn’t deserve it.
‘The question then is why does this have to be forced upon us? That’s the difference.
‘We above all lost it because we used up a lot of energy by playing down to 10 men.
‘At the end, that equaliser for 2-2 was so chaotic and unlucky. The team deserved a more fortunate outcome, quite frankly.
‘It’s difficult to make them accept it, because the problem is that you must give the players the credit they deserve.
‘This is the game that means a lot for us, for the fans, for everyone. It’ll take more than one sleepless night to shake that off.’