Maurizio Sarri’s men had to win to keep their faint hopes of finishing top alive, but Gonzalo Higuain and Co could not find a way past Wojciech Szczesny in the hosts’ goal.
Nainggolan, who is a target for incoming Chelsea boss Antonio Conte, smashed a fine, low strike into the bottom corner in the 89th minute, giving the visitors no chance to reply.
The Juventus squad watched the game at their HQ in Vinovo and were seen celebrating joyously in the dressing room after the final whistle.
Juventus all but clinched their fifth straight Serie A title with three matches to spare after winning 2-1 at Fiorentina on Sunday and Napoli’s subsequent defeat.
It was Juve’s 32nd Italian league title – although the club still consider that to be 34 as two were taken away after the 2006 match-fixing scandal known as Calciopoli.
The squad were seen all wearing t-shirts with the number 34 printer on the back as the club defiantly insist that they still deserve the two honours they were stripped of.
Allegri, who has been in charge for the last two seasons, wants that to change and is determined to strengthen the squad still further in the close season.
‘The club will focus on improving the squad, as it did last summer, bringing in young players with great technique. Next year we must focus on winning the Champions League. It’s somewhat narrow-minded just to focus just on Serie A,’ he said.
‘It was hard to digest this year. We got knocked out this year on the final cross of the game against Bayern Munich but we need to do better next year.’
In many ways, this year’s title has been the most remarkable of Juve’s last five.
They got off to a miserable start after losing legendary playmaker Andrea Pirlo as well as top scorer Carlos Tevez to his native Argentina and tireless midfielder Arturo Vidal to Bayern Munich, and were 11 points off the pace by the end of October.
But after taking an amazing 73 points out of their last 75, they clinched another title with three games to spare.
‘To win this season would be really crazy and unbelievable,’ said goalkeeper Gianluigi Buffon after the 2-1 win at Fiorentina on Sunday. ‘We’ve shown the technical and moral strength of the group, the determination not to give in and our ability to astonish.’