Updated

Toronto, ON (SportsNetwork.com) - James Johnson scored a season-high 20 points, including a go-ahead 3-pointer with less than a minute to play to lift the Toronto Raptors to an 87-82 win over the San Antonio Spurs on Sunday.

Trailing 82-79 with 1:49 to play, the Raptors scored the last eight points of the game to end their seven-game losing streak to the Spurs.

DeMar DeRozan added 18 points for the Raptors and Jonas Valanciunas delivered eight points and 16 rebounds.

San Antonio started a nine-game road trip with a loss and coach Gregg Popovich was denied his 1,000th career win.

Tim Duncan had 12 points and 12 boards and Marco Belinelli netted 12 as well in the loss.

"We're not trying to win for one person or another, we're trying to better our team and end (the first half of the season) strong," Duncan said.

The Spurs went on a 9-0 run early in the third quarter to take an eight-point lead. Raptors coach Dwane Casey called for a timeout and Toronto immediately tightened up its defense, with the Spurs only shooting 25 percent the rest of the game.

Out of the timeout, the Raptors rattled off 10 straight points to retake the lead. Amir Johnson scored the first four points, and Valanciunas had four of the last six. Kawhi Leonard's jumper at the 2:18 mark was San Antonio's only field goal after Casey's timeout, and the Raptors led 64-58 going into the fourth quarter.

Manu Ginobili's layup opened the scoring 11 seconds into the fourth, but Toronto soon extended its lead back to eight. The Spurs were able to battle back, and Tony Parker's triple with five minutes to play tied the game.

Belinelli hit his second 3 of the quarter with 2 1/2 minutes to go, and Parker's layup 30 seconds after that put San Antonio up 82-79.

A minute later, Kyle Lowry was cutting into the lane when he found James Johnson wide open in the corner. Johnson hit the 3 to put the Raptors up for good.

"He wouldn't just throw that pass if he wasn't all the way confident in me taking it," said Johnson. "That's what the work is paying off for."

San Antonio made just three of its first 15 attempts, but finished the first quarter on a high note, scoring eight points in the final 67 seconds capped by Ginobili's 3 as time expired, to cut Toronto's lead to 28-25.

The Spurs' defense turned the tables on Toronto in the second quarter. The Raptors scored just five points through the first seven minutes of the period, and Leonard's alley-oop put San Antonio up 46-37 with 3:16 remaining.

San Antonio went into another drought to close the half and led 46-45 going into the break.

Game Notes

James Johnson is shooting 15-of-17 since returning from a four-game absence ... The Spurs fell to 9-1 when allowing fewer than 90 points ... Duncan played in his 1,300th NBA game ... Amir Johnson had 15 points and eight rebounds, and Lowry scored 12 with seven assists ... The Spurs shot just 33.3 percent.