The defending champion Heat won their 13th straight game and improved to 26-3 at home. Memphis had an eight-game winning streak snapped.
Miami held only a one-point lead heading into the fourth quarter in a contest that lived up to its billing and the Grizzlies still trailed by just one after Marc Gasol hit a layup with 42 seconds to play.
James then came through with his clutch 3-pointer near the end of the shot clock and he added five free throws over the final 12 seconds to protect the lead.
He had just 18 points -- nine below his season average -- but 14 of them came in the fourth quarter and he also contributed 10 assists and eight rebounds.
Dwyane Wade led Miam in scoring with 22 points while the Heat won at home for the 11th straight time.
Gasol produced 24 points and nine rebounds for Memphis.