DETROIT -- In the final seconds of both regulation and overtime, DeMar DeRozan pushed the ball up the court and went straight toward the basket.
The first time, he threw down a dunk for the game's most spectacular highlight. Then a few minutes later, DeRozan had the ball in his hands again in a similar spot.
"I knew they would be more prone to collapse on me the next time," the Toronto star said.
With Detroit's defenders cutting off his path to the rim, DeRozan made a simple pass to Fred VanVleet, whose tiebreaking jumper with 1.1 seconds remaining gave the Raptors a 121-119 victory over the Pistons on Wednesday night.
DeRozan finished with 42 points in the overtime win, and Toronto became the first NBA team to clinch a playoff berth this season.
"We need to be hardened and face some adversity," Raptors coach Dwane Casey said. "Tonight was one of those tests. I think each game we go into, everybody's going to give us their best shot."
Toronto trailed by 17 in the second quarter but was able to outlast Blake Griffin and the Pistons in a back-and-forth thriller. With the score tied late in overtime, Detroit's Reggie Bullock missed an open 3-pointer with about five seconds left on the shot clock. The rebound went to DeRozan, who rushed into the frontcourt and got into the lane, where a couple defenders stood in his way. He passed to VanVleet in the left corner.
Until then, VanVleet was 1 for 9 from the field, but his shot from just inside the 3-point line gave Toronto the lead.
"To win the game at the end there makes me be able to sleep a little bit better at night," VanVleet said.
Griffin, who had tied the game with less than a second remaining in regulation, missed a 3-pointer on the final possession of overtime.
The Eastern Conference-leading Raptors have won six straight and 13 of 14. Detroit has lost four in a row and 10 of 12.
Toronto's Serge Ibaka was ejected in the second quarter.
After Griffin's three-point play put Detroit ahead 112-111 with 10.1 seconds left in the fourth quarter, Toronto was out of timeouts. But the Pistons lost DeRozan near midcourt, and he went all the way in for a dunk with 4.6 seconds left, drawing a foul in the process.
"We didn't do what we were supposed to do. I'm not going any further than that," Pistons coach Stan Van Gundy said. "I'm not going to throw someone under the bus, but we didn't do what we were supposed to do."
DeRozan cut a finger, but he made the free throw to put the Raptors up by two. Griffin scored inside with 0.9 seconds left to tie it.
Raptors: G Deion Wright left the game with a sprained big toe on his right foot, and F OG Anunoby was out with a sprained right ankle. ... Toronto trailed 59-45 at halftime before outscoring Detroit 40-25 in the third quarter.
Pistons: F Stanley Johnson missed the game because of back spasms.
Toronto leads Boston by 2 1/2 games atop the East. Detroit is now five games out of the final playoff spot in the conference.
With Detroit located right on the border with Canada, there were plenty of Toronto fans on hand, and chants of "Let's go Raptors!" broke out periodically.
There were three turnovers in the final second of regulation. After Griffin's tying bank shot, the Raptors' inbound pass went out of bounds off a Toronto player around midcourt with 0.3 seconds to play. Then Griffin's long pass toward the basket went out without touching anyone, giving the ball back to the Raptors.
They tried a similar long pass, but the same thing happened.
"Neither one of us had timeouts," Casey said. "Just kind of trying to give it back to each other."
Raptors: Host the NBA-leading Houston Rockets on Friday night.
Pistons: Host the Chicago Bulls on Friday night.
More AP NBA: https://apnews.com/tag/NBAbasketball
Follow Noah Trister at www.Twitter.com/noahtrister
Adrian Wojnarowski explains why Timberwolves owner Glenn Taylor is keeping Jimmy Butler available and what this could mean for Tom Thibodeau.
Commissioner Adam Silver said Friday he decided against suspending Mavericks owner Mark Cuban, in part, because an investigation into harassment and violence toward female employees concluded the owner wasn't directly implicated in the conduct.
Free-agent guard Tyler Ulis, who averaged 7.8 points and 4.4 assists with the Suns last season, has signed with the Warriors on a one-year contract paying the minimum salary, a source told ESPN.