The result means these were the first points dropped by the Turin side since the season restarted last month.
Juventus appeared to be cruising to another win when Adrien Rabiot put them ahead with a solo goal two minutes after the break.
Cristiano Ronaldo added a second with a typical effort, his 26th league goal of the season.
Franck Kessie equalised four minutes later and Rafael Leao put them ahead one minute after that, before Ante Rebic completed the scoring in the 80th minute.
In spite of the defeat, Juve on 75 points stayed seven points clear with seven matches to play after second-placed Lazio earlier lost 2-1 at lowly Lecce.