James hit 10-of-17 shots from the field and claimed six rebounds while Dwyane Wade added 22 points, seven rebounds and six assists.
Toronto fought back from a 19-point deficit in the third quarter to trail by just three with 4:43 to play.
James then made a jumper and neither side produced a point for almost 3 minutes before a layup by James gave the Heat a seven-point lead.
DeMar DeRozan led Toronto with 25 points and Rudy Gay had 21.
It was Miami's ninth straight win. Toronto has lost its last 13 meetings with the Heat.