Although the Cavs were missing All-Star guard Kyrie Irving, Dion Waiters and Anderson Varejao their top three scorers they pushed Miami to the limit.
It wasn't until James, playing his fourth game back in Cleveland since leaving as a free agent in 2010, made two free throws with 4.7 seconds left that Miami could relax a little. The Cavs had one last chance to level it, but C.J. Miles was long with a 3-pointer in the final second, letting Miami off the hook.
Following the game, James stopped to sign a few autographs as he made his way to Miami's locker room. This was much tougher than he and the Heat could have imagined.
Mario Chalmers added 17 points and Dwyane Wade had 11 for the Heat, who outscored the Cavs 30-18 in the fourth quarter and 64-40 in the second half.
Wayne Ellington had 20 points and Tristan Thompson 18 for Cleveland, which went from tbe verge of a stunning upset to blowing the biggest lead in a loss in the club's history.
Down by nine to open the fourth, the Heat were up 95-86 with 3:02 left and seemed to have the Cavaliers on the ropes.
But Cleveland bounced back and closed to 96-95 on Thompson's two free throws with 44 seconds to go. Wade then missed a jumper, but Ellington misfired on a step-back 23-footer with 5.2 seconds to go.
James was fouled and the reigning MVP, with a sellout crowd of 20,562 roaring, stepped to the line and dropped both free throws to make it 98-95.
Miles was contested on his final shot, and once it clanked off the rim, the Heat prepared to head for home with a chance to extend their streak to 25 on Friday against Detroit.
The start of the game was delayed 35 minutes because of a spill on the floor caused by condensation from a carbon dioxide container inside the scoreboard.
James was standing at midcourt awaiting the opening tip when arena workers first noticed a pool of liquid on the floor. As ball boys tried to mop it up, the officials sent both teams to their locker rooms and the giant scoreboard was lowered to the floor so the problem could be fixed.
The team returned and warmed up for five minutes before the game got under way.
-AP