Chris Bosh scored 16 points, Ray Allen added 12 and Shane Battier scored 11 for the Heat, who matched the 12th-longest winning streak in NBA history and became the first team in the league to clinch a playoff spot this season.
Down by nine in the third quarter, the Heat took a 76-75 lead when James beat the buzzer to end the period with a 3-pointer, then took control with what became a 17-4 run over a 5-minute stretch of the fourth.
Thaddeus Young scored 25 points, Dorell Wright added 14 and Spencer Hawes finished with 13 points and 10 rebounds for the 76ers, who lost their 12th straight on the road and 13th straight regular-season game against Miami. Jrue Holiday added a game-high 13 assists for Philadelphia.
Still, with 12 minutes to go, this one was far from over.
Philadelphia gave the Heat all they wanted for the first three quarters, taking a quick 18-11 lead, then making its first five attempts from 3-point range in the second quarter, and finally going on a spurt in the third that had Miami facing a 60-51 deficit at one point.
Much as they did in the first 16 of these wins, the Heat - now winners of 13 straight at home, heading into Sunday's playoff rematch in Miami against Indiana - found a way.
Miami had 10 assists on 12 field goals in the third quarter and took a second-half lead for the first time on a brilliant move by Bosh - who spun to his right, got fouled by Hawes and scored with his left hand anyway, all while being off-balance. His free throw put the Heat up 65-64.
Wright, whose career started in Miami, hit a 3-pointer to put Philadelphia back up 71-67, before the Heat closed the third with a trio of 3-pointers from Mario Chalmers, Battier and then James, whose buzzer-beater came seconds after he was hit in the throat area by Philadelphia's Damien Wilkins.
James shook off the hit, made the 3, then took a brief look at the Philadelphia bench for emphasis.
He was fired up, and the mood permeated everyone on the Miami side in the fourth, when the Heat pulled away.
Miami had some big moments in the early going, including one possession where James had three offensive rebounds - two off his own misses - before scoring, and another when Chris Andersen blocked shots by Evan Turner in succession to set up a possession where James got an alley-oop dunk.
But Philadelphia didn't go away, fueled by the second-quarter 3-point barrage, and nine points by Wright in just 4:28 of the third quarter.
The fourth, however, was all Miami, even with James on the bench for the final minutes.