Dallas put together a 20-5 fourth-quarter run, cutting its deficit to 91-88 with 44 seconds left.
But Goran Dragic cut to the basket, got a pass from James Johnson and hit a reverse layup with 25 seconds left, putting Miami ahead 93-88 and sealing the deal.
Dragic finished with 13 points as Miami improved to 11-4 in its past 15 games. Heat small forward Josh Richardson had a well-rounded game with 14 points, four blocks, three assists and three rebounds.
Harrison Barnes led Dallas with 20 points and Wes Matthews added 19 points.
The Mavericks -- who are starting two rookies - Dennis Smith (14 points, 10 assists) and Maxi Kleber (nine points) -- have lost four straight games and seven of eight.
Backup point guard Devin Harris, who had missed the past four games due to a concussion, returned to Dallas' rotation and scored two points in 16 minutes.
Harris' return was needed because Dallas was without another backup point guard, Jose Juan Barea, who played his high school ball in Miami and has missed two straight games due to a strained left oblique injury.
Dallas led 26-22 after the first quarter, closing the period on a 16-5 run. The Mavericks shot 55.0 percent in the quarter and held Miami to 41.7-percent shooting.
Miami took control in the second quarter, leading by as many as 10 points. But Smith hit a 3pointer at the buzzer as Dallas cut its deficit to 51-46.
Miami dominated the third quarter, building a 75-61 lead. The Heat held Barnes scoreless in the quarter.
The Heat led by as many as 18 points in the fourth quarter, but Dallas rallied. A 3-pointer by Matthews and a free throw by Barnes cut the deficit to 91-88 before Dragic had the answer.
--Field Level Media
Miami | Dallas | |
Hassan Whiteside 25 | Scoring | Harrison Barnes 20 |
James Johnson 6 | Assists | Dennis Smith Jr. 10 |
Hassan Whiteside 14 | Rebounds | Dwight Powell 10 |
Hassan Whiteside 5 | Free Throws Made | Dennis Smith Jr. 5 |
Tyler Johnson 3 | Steals | Dwight Powell 3 |
Josh Richardson 4 | Blocks | Devin Harris 1 |
Team | Points | FG% | 3PM-3PA | FTM-FTA | Assists | Rebounds | Blocks | Steals | Turnovers |
Miami | 95 | 45.3 | 12-31 | 15-19 | 23 | 41 | 11 | 9 | 17 |
Dallas | 88 | 38.4 | 8-29 | 14-16 | 20 | 40 | 3 | 10 | 12 |