James stepped away from the Golden State defender and drained a nearly uncontested trey with 2/10ths of a second left.
Miami shot 53.8 percent from the field to Golden State's 48.2 percent. The Warriors won the rebounding battle 43-35.
Stephan Curry went 4-for-4 from the 3-point line and led the Warriors with 29 points. David Lee scored 21 and had 11 rebounds.
Curry hit a running bank shot and then a free throw to complete a 3-point play that gave Golden State a 110-108 lead with 14.6 seconds to play, which delighted the sold-out house in Oakland but merely set the stage for James' heroics.