Leonard scored the go-ahead basket with three seconds remaining and the Raptors held on to beat the Trail Blazers 119-117 Friday night.
"We just practiced that exact scenario yesterday," Raptors coach Nick Nurse said. "It was great. Kyle sets a screen and we try to get the smaller guy so (Leonard) can just vault up over him and shoot."
Toronto had run the same play moments earlier, with Lowry making a layup. When the play was called again, Leonard was more interested in keeping the ball himself.
"I was looking to get baseline," Leonard said. "That first time I had seen I could be a little bit more aggressive and that's what I did the second time down."
Leonard scored 38 points and Lowry had 19 points and 10 assists as the Raptors won for the ninth time in 10 games. Toronto is an NBA-best 11-4 in games decided by three points or fewer.
"Just staying composed and understanding that situations aren't always going to be perfect," Lowry said.
C.J. McCollum scored 35 points and matched a career best by making seven 3-pointers, but it wasn't enough to extend Portland's season-best five-game winning streak.
Lillard scored 24 points and Jake Layman had 13 as the Trail Blazers suffered their first lost after winning four straight to begin a seven-game trip.
"Obviously it's disappointing to lose but I like the way we competed," Portland coach Terry Stotts said.
Ahead 93-84 to begin the fourth, the Raptors missed nine consecutive field goal attempts, allowing Portland to close to within one, 95-94, on a 3-pointer by Lillard at 6:47.
Leonard ended Toronto's drought with a layup, but the Raptors couldn't hold the lead, and Lillard tied it 103-all with another 3 at 3:27.
Lillard made another tying 3 with 13 seconds left, but Leonard won it with his baseline jumper.
"The ball hit every part of the rim," Lillard said. "That took time off. If it had gone straight in, it almost would have been better."
By the time Portland inbounded the ball, there was barely enough time for a full-court heave.
The Raptors connected on 11 of 17 shots in the first quarter and led 31-24 after one.
Leonard scored 10 points in the second and Toronto led 61-54 at halftime.
McCollum scored 14 points in the third but the Raptors responded with five 3-pointers, taking a 93-84 lead into the fourth.
"They had an answer every time," Lillard said.
Trail Blazers: Slowed by foul trouble, C Jusuf Nurkic did not attempt a shot in five first-half minutes. ... Portland is 18-5 against Eastern Conference opponents. ... The Trail Blazers are 0-15 on the road when trailing through three quarters.
Raptors: Toronto had nine assists on 11 made baskets in the first. ... The Raptors made their final six shots of the game. ... Lowry has had at least 10 assists in three straight games.
MAKING HIS MARC
Gasol's 19 points were his most with Toronto. He also had six assists and eight rebounds.
"He was really good tonight," Nurse said. "It looked like all of a sudden the rust was gone."
Portland lost for the first time in nine games against Atlantic Division opponents. Toronto, which is 9-0 against the Pacific Division, is the only NBA team with an unbeaten record against a single division.
Portland center Enes Kanter did not travel to Toronto with the team. An outspoken critic of Turkish President Recep Tayyip Erdogan, Kanter's Turkish passport was revoked in 2017, and Turkish prosecutors have accused Kanter of membership in a terror organization. While playing for the Knicks earlier this season, Kanter did not accompany the team for a game in London because he feared he could be killed over his opposition to Erdogan.
Trail Blazers: Visit Charlotte on Sunday.
Raptors: Visit Detroit on Sunday.
More AP NBA: https://apnews.com/NBA and https://twitter.com/AP-Sports
2020 NBA free agency and trades: Latest buzz, news and reports
NBA trade season and free agency are nearly upon us. Keep it here for the latest news and updates all offseason long.
NBA free agents 2020: Predicting starting salaries for the best available players
What are the likely salary ranges for every available player in the 2020 offseason?
The Kobe 5: Behind the biggest sneaker tribute in basketball
NBA and WNBA players share their journeys wearing Kobe's shoe this year