Ciro Immobile scored twice early in the second half for Lazio, the second goal a penalty, after Douglas Costa had given the champions a halftime lead.
Juve's last home defeat was against Udinese in August, 2015 and they have since been unbeaten at their own stadium for 57 matches, including 41 in Serie A.
There was extraordinary drama in stoppage time when Dybala hit the foot of the post and Juventus goalkeeper Gianluigi Buffon prevented Felipe Caicedo from making it 3-1 at the other end. Then, with four minutes of added time played, Gil Patric clattered into Federico Bernardeschi and, although he touched the ball, he also raised his leg and upended the Juventus player.
The tackle led to scuffles between players while referee Paolo Silvio Mazzoleni consulted the video assistant before awarding a penalty amid furious Lazio protests. However, Dybala's effort with the last kick of the match was brilliantly saved by Thomas Strakosha.
Juve's first league defeat of the season left them on 19 points from eight games, two behind leaders Napoli who were away to AS Roma later on Saturday. Costa put Juventus ahead in the 23rd minute from a rebound after Strakosha parried Sami Khedira's header, the goal being confirmed after the referee consulted the VAR. Juventus nearly got another in an odd incident when Strakosha's clearance off his line hit Gonzalo Higuain and rebounded on to the crossbar from point-blank range.
Immobile levelled two minutes into the second half after a one-two with Luis Alberto, then won and converted a penalty seven minutes later, after he was upended by Buffon, for his eleventh league goal of the season