James Johnson scored 20 points, including a go-ahead three-pointer in the last minute, as Toronto edged San Antonio 87-82 on Sunday to deny Spurs coach Gregg Popovich a 1,000th NBA win.
Trailing 82-79 with 1:49 remaining, Toronto scored the last eight points of the game to end a run of seven straight losses to the Spurs.
DeMar DeRozan added 18 points and Jonas Valanciunas delivered eight points and 16 rebounds for the Raptors.
Tim Duncan had 12 points and 12 rebounds and Marco Belinelli scored 12 as well for the reigning NBA champion Spurs, who started a nine-game road trip with the defeat.
The Spurs, who shot just 33.3 percent from the floor, will try to get back on track on Monday when they visit Indiana.
Popovich, who has coached the Spurs to five NBA championships, remains one triumph away from becoming the ninth coach to record 1,000 NBA wins.
With his team`s next victory, he`ll join former Utah Jazz coach Jerry Sloan as the only coaches to notch that many wins with a single franchise.
In a see-saw battle, San Antonio went on a 9-0 scoring run early in the third quarter to take an eight-point lead.
Toronto coach Dwane Casey called for a timeout and the Raptors bore down on defense, with the Spurs connecting on just 25 percent of their shots from the field for the rest of the game.
Coming out of the timeout, Toronto reeled off 10 straight points to regain the lead and the Raptors took a 64-58 lead into the fourth quarter.
A three-pointer by San Antonio`s French point guard Tony Parker tied the game with five minutes to play.
Belinelli hit his second three-pointer of the quarter with two and a half minutes to play and a layup from Parker less than a minute later gave the Spurs an 82-79 lead.
A minute later, Kyle Lowry was cutting into the lane when he found Johnson wide open beyond the three-point line and Johnson made the shot to put Toronto ahead for good.