02/08/2015 09:32 EST | Updated 04/10/2015 05:59 EDT

James Johnson has 20 points, Valanciunas 16 boards in Raptors' win over Spurs

TORONTO - The nights James Johnson played little, he would make a beeline for the Air Canada Centre's practice court after the final buzzer to work on his shooting. He figured it would eventually pay off.

That moment came Sunday night when Johnson scored a team-high 20 points and drilled a three-point shot with 50 seconds left to lift the Toronto Raptors 87-82 over the defending NBA champion San Antonio Spurs.

"You never know how many minutes you're going to get, when's your next opportunity to play, so you just have to stay ready," Johnson said. "Give a lot of credit to (Raptors assistant Jama Mahlalela), always coming up there, sacrificing some dinner times with me coming up there at nighttime. It's working out."

DeMar DeRozan added 18 points, while Amir Johnson had 15 and Kyle Lowry had 12. Jonas Valanciunas grabbed a season-high 16 rebounds in one of Toronto's best defensive efforts of the season, and the team's eighth win in 10 outings.

DeRozan called it a defining victory.

"It was against a great team. They're champions. They're a hell of a team. It was a good game for us tonight," he said. "Tonight was a great test for us. San Antonio is probably the best team in the league at moving the ball, getting easy shots. They've got a lot of trick plays that you've got to be aware of every single second of that shot clock. I think we did a pretty good job."

The Atlantic Division-leading Raptors (35-17) were coming off a huge 123-107 win over the Clippers on Friday that saw them claw their way back from an early 20-point deficit.

Neither team led by more than 10 in Sunday's dogfight, and the Raptors went into the fourth quarter clutching a 64-58 advantage in front of an Air Canada Centre capacity crowd of 19,800 that included Toronto FC's newest acquisition Sebastian Giovinco.

The Spurs fought back and a three-pointer by Marco Belinelli with 2:20 to play gave San Antonio a three-point lead. A dunk from Amir Johnson got the fans on their feet and cut the lead to one. Then James Johnson — who started in place of Greivis Vasquez in just his second game back from missing four with a hamstring injury — connected on his long-range bomb.

"Just took it with confidence," Johnson said on his three. "Kyle, he's a great guard, he's going to set guys up, and I thought he set that up, he wouldn't just throw that pass if he wasn't all the way confident in me taking it. That's what the work's paying off for."

The Raptors dug in on defence on the Spurs' next possession, then James Johnson sunk a free throw with four seconds left to seal Toronto's victory.

"At the end of the day we're trying to get to where (the Spurs) are and where they've been," Lowry said. "It was a great test for us. They know every single night they're getting every team's best shot because of who they are. So for us it was a stepping stone for our growth."

The Spurs were a horrible 31-for-93 shooting, as the Raptors held the Spurs' big three of Tim Duncan, Tony Parker and Manu Ginobili to a combined 10-for-40.

"To hold a team like that to their season low of 33 per cent is admirable on our guys' part," said Raptors coach Dwane Casey. "It should show us how we have to play, to grind it out."

The Raptors' five-game homestand ends Wednesday when they host the Washington Wizards.

The Spurs' loss left coach Gregg Popovich just one win shy of 1,000.

James Johnson led the way with eight first-quarter points to help the Raptors go up by 10. But the Spurs closed the quarter with an 11-2 run, and the Raptors took a narrow 28-25 lead into the second.

A Belinelli finger roll capped a 17-5 Spurs run that gave San Antonio a nine-point lead midway through the second. Toronto replied with a 7-0 run to head to the halftime dressing room trailing by just a point, 46-45.

The Raptors held the Spurs to just 12 points in a third quarter that saw them race out to a 17-3 run for a six-point lead heading into the fourth quarter.