Game on the line, LeBron James knew he was going to get to the rim.
And he delivered.
James scored 26 points, including a go-ahead layup after getting past DeQuan Jones with 3.2 seconds left, and the Heat scrambled late to beat the Orlando Magic, 97-96, Wednesday night in Miami and extend their franchise-record winning streak to 16 games.
‘‘I had no intention of shooting another jumper,’’ James said.
He missed a pair of 3-pointers about 90 seconds earlier, so he went for the 3-footer instead. From the right wing, James drove diagonally through the lane, then used his left hand — after all, he is left-handed — for the basket that won it for Miami.
It was the first time he came up with what became a game-winning basket in the final five seconds of a game since a 3-pointer beat the Magic in the 2009 playoffs, according to STATS LLC.
‘‘This is tough,’’ Magic coach Jacque Vaughn said, after his team fell to 0-2 against Miami this season — the two losses by a total of 3 points. ‘‘You've got guys who battled, who really wanted to win this game and deserved to win this game.’’
The Heat blew a 20-point, second-half lead, then rallied from a 5-point deficit in the final minutes.
Lakers 108, Hornets 102 — Kobe Bryant scored 13 of his 42 points during a 20-0 run in the last 6:22 of the fourth quarter, and visiting Los Angeles overcame a 25-point deficit to fend off New Orleans.
The Hornets were still ahead by 21 in the final minute of the third quarter when Greivis Vasquez’s 3-pointer made it 93-72, and even after the Lakers had whittled their deficit to 12, the Hornets were up, 102-88, after Robin Lopez’s dunk with 6:47 to go. But the Hornets would not score again.
Cavaliers 104, Jazz 101 — Kyrie Irving scored 20 points and Cleveland’s All-Star guard made all the big plays down the stretch to spark a rally over visiting Utah.
The Cavs trailed, 100-92, with less than three minutes left before Irving took over.
He scored 8 points, made a steal, and assisted on Wayne Ellington’s dunk as Cleveland stormed back to stun the Jazz.
Knicks 87, Pistons 77 — Raymond Felton scored 26 points, and visiting New York pulled away in the fourth quarter to beat Detroit despite Carmelo Anthony’s absence.
Anthony sat out after injuring his right knee Monday, but New York went on a 16-0 run in the fourth to put away the game.
Hawks 107, 76ers 96 — Jeff Teague scored 27 points, Anthony Tolliver added a season-high 21, and host Atlanta bounced back from a sluggish start and snapped a three-game losing streak by beating Philadelphia.
Nets 99, Bobcats 78 — Deron Williams had 20 points and eight assists, Joe Johnson added 22 points, and Brooklyn sent host Charlotte to its eighth straight loss.
The Nets trailed by 10 at the half, but opened the third quarter with a 21-6 run and never looked back.
Grizzlies 91, Trail Blazers 85 — Marc Gasol had 23 points and 12 rebounds, Jerryd Bayless scored all 13 of his points in the final 13 minutes, and host Memphis came back from 17 points down in the third quarter to beat Portland.
Timberwolves 87, Wizards 82 — Ricky Rubio had 15 points, 11 assists, 7 rebounds, and 6 steals to help Minnesota snap a six-game losing streak in defeating Washington.
Raptors 98, Suns 71 — DeMar DeRozan scored 15 points and Amir Johnson added 14 to lead visiting Toronto.
Mavericks 112, Rockets 108 — Dirk Nowitzki scored 22 points, O.J. Mayo had two big fourth-quarter baskets and a career-high 12 assists, and host Dallas avenged a blowout loss in Houston three days ago.
Clippers 117, Bucks 101 — Blake Griffin had 23 points, 11 rebounds, and 11 assists for his third career triple-double, and host Los Angeles beat Milwaukee for its 10th win in 13 games.
Spurs 101, Bulls 83 — Tim Duncan had 18 points and 10 rebounds, and host San Antonio beat Chicago.
Warriors 87, Kings 83 — Klay Thompson made the go-ahead 3-pointer with 7.5 seconds remaining and finished with 20 points to lead host Golden State over Sacramento.