LeBron James scored 26 points, including a go-ahead layup with 3.2 seconds left, and the Miami Heat scrambled late to beat the Orlando Magic 97-96 on Wednesday night and extend their franchise-record winning streak to 16 games.