The Heat had lost three of the previous four games on their six-game road trip, but they breezed to a victory against the Warriors on what became a milestone night for James.
He entered the contest needing 18 points to get to 20,000 and he finished with 25.
James is the 38th player to score 20,000 points, but he got to the mark more than a year earlier than the player who had previously been the youngest to achieve that figure.
In addition to scoring his 20,000th point, James recorded his 5,000th assist. He came close to a triple double with seven rebounds and 10 assists.
Jarrett Jack scored 16 for the Warriors, who suffered 21 turnovers while making only 3-of-12 from 3-point range.