The veteran midfielder netted in the dying seconds, after Bruno Peres had looked to have earned the visitor a point by canceling out Arturo Vidal's opener.Andrea Pirlo scored a sensational last-gasp winner as Juventus defeated Torino 2-1 in the Derby della Mole on Sunday evening.
The veteran playmaker lashed home a low shot from 25 yards with virtually the last kick of the game to cruelly deny the Granata and extend the Bianconeri's remarkable winning run at home in the league to 25 matches.
It looked as though the reigning champion and leader would have to settle for a draw when Torino's Bruno Peres scored a superb individual goal midway through the first half, canceling out Arturo Vidal's twice-taken penalty in the 15th minute.
The home side was even reduced to 10 men in the 78th minute when Stephan Lichtsteiner picked up a second yellow card, but Massimiliano Allegri's men were still able to find a winner right at the end.
Peres' goal was Torino's first against its fierce rivals since February 2002, and it looked as though it would be the first visiting side to come away from a league game at Juventus Stadium with anything since Cagliari in May 2013.
But Pirlo had the final word, a typically accurate finish leaving Jean-Francois Gillet with no chance and allowing the home fans to celebrate a seventh consecutive derby win.
Patrice Evra came in at left back for the suspended Simone Padoin as one of two changes for Juve from their midweek UEFA Champions League win over Malmo.
The other saw goalkeeper Gianluigi Buffon miss out with a shoulder problem, replaced by Marco Storari who made his first appearance of the season.
Storari held an early free kick from former Juve man Fabio Quagliarella, but the host was soon ahead through Vidal's penalty.
Pirlo's free kick was handled by Omar El Kaddouri in the wall and, after placing his first effort into the top-right corner, Vidal sent his second into the bottom-left with cool precision.
The visitor was not behind for long, however, as Peres equalized with a goal of sheer brilliance.
The Brazilian picked the ball up on the edge of his own box and stormed down the right flank, beating Paul Pogba, Evra and Vidal for pace before thumping an angled finish across Storari and in off the left-hand upright.
Torino continued to pose a threat after the interval and a sliding Quagliarella diverted Amauri's low cross narrowly wide of the near post from close range in the 52nd minute.
Leonardo Bonucci tested Gillet with a low skidding drive from distance five minutes later and Juve was further frustrated 15 minutes from time when Vidal had a goal rightly ruled out for offside.
Their quest for a winner was made even harder three minutes later as Lichtsteiner was shown a second yellow card for a foul on El Kaddouri.
Yet Pirlo provided a sensational finale with seconds remaining, drilling a shot into the bottom-left corner following Vidal's lay-off.