Danny Green made a fade-away jumper with less than a second remaining to lift Toronto over Orlando.
Green caught Kyle Lowry's inbound pass with 2.3 seconds left, pulled up on the left side of the lane and hit a jumper with 0.5 seconds remaining. Orlando's Nikola Vucevic missed on a 67-foot heave as time expired.
Kawhi Leonard led Toronto with 18 points, and Pascal Siakam had 15. Serge Ibaka added 14 points and nine rebounds, and Green finished with 13.
Evan Fournier led the Magic with 27 points, 22 of them in the second half when he was about the only offense Orlando could generate. Aaron Gordon had 16 points, and Vucevic had 14 points and 18 rebounds for the Magic, who ended a three-game winning streak.
Fournier drove past Green for a tying dunk with 2.3 seconds left. The Raptors took a full timeout, and Green scored on the ensuing inbound.
Portland 118, at New York 114: CJ McCollum scored 31 points, Damian Lillard had 29 points, eight assists and six rebounds, and Portland beat New York.
Portland's star guards provided most of the offense in a game that was close most of the way, and Evan Turner helped the Trail Blazers finally pull it out when he put back a missed shot with Portland clinging to a two-point lead and 9.5 seconds remaining.
Jusuf Nurkic finished with 13 points and 10 rebounds for the Blazers, who have won two straight after dropping the first two games on their trip that now heads to its difficult conclusion. Portland plays Milwaukee on Wednesday and closes it at Golden State.
Tim Hardaway Jr. scored 32 points for the Knicks, who dropped their sixth straight. They were a bit better than the previous games of the skid, when they yielded 126.2 points per game, but not good enough to stop the early Western Conference leaders.
Brooklyn 104, at Miami 92: D'Angelo Russell scored 20 points, Jarrett Allen had 13 points and 14 rebounds, and Brooklyn added to Miami's misery at home.
Spencer Dinwiddie scored 16 points for Brooklyn, which held the Heat to 36 percent shooting. Joe Harris and DeMarre Carroll each added 11 for the Nets and Rondae Hollis-Jefferson scored 10.
Hassan Whiteside had 21 points and 23 rebounds for Miami, which dropped its fifth straight at home — all on their “Vice” themed court. No Heat team has ever had a home losing streak of five or more games and went on to make the playoffs.