Rookie Mohamed Bamba dunked twice and blocked a shot during Orlando's 9-0 run in the fourth quarter and the Magic held on for a 104-101 win over the Miami Heat in the NBA season opener for both teams Wednesday night.
Aaron Gordon had 26 points and 16 rebounds for the Magic, who went without a field goal over the final 4 1/2 minutes.
Goran Dragic led Miami with 26 points and Josh Richardson added 21.
With the Magic leading 86-81 early in the fourth quarter, Bamba swatted away a shot by Richardson, and Terrence Ross got his hands on two more Heat shots during a scoreless stretch of nearly four minutes for Miami.
Bamba dunked in two Orlando misses, and Jerian Grant hit a jumper to lift the Magic to a 92-81 lead with 7:50 remaining.
Richardson, Dragic and backup center Bam Adebayo rallied the Heat in the closing minutes, and after the Magic missed three free throws in the final 12.3 seconds, Miami had a chance to win. But Richardson dribbled out of bounds before Evan Fournier hit two free throws with 1.6 seconds left for the game's final points.
Miami led 28-14 after Richardson's 3-pointer late in the first quarter. But after making their first four shots and 10 of their first 19, the Heat went cold for the rest of the half.
Complete coverage of the 3-time NBA champions
A 3-pointer by Nik Vucevich gave Orlando its first lead of the game at 37-36, and the Magic led 54-51 at halftime in spite of Dragic's 16 points and Fournier's 0-for-5 from behind the 3-point line.
The 7-foot Bamba finished with 13 points and seven rebounds in his NBA debut.
Dwyane Wade, playing the first game of his 16th and final NBA season, had nine points and 11 rebounds in 26 minutes for the Heat.
Heat: F Justise Winslow (hamstring), G Wayne Ellington (ankle), G Dion Waiters (ankle) and F James Johnson (hernia) did not play and are not expected to play Thursday night.
Magic: The Magic made 7-of-25 3-point shots and missed 12 free throws. . . Orlando is 52-64 all-time against its intrastate rival, but has won 7 of the last 11.
Heat: At Washington on Thursday night.
Magic: At home against Charlotte on Friday night.