"If we were going to go down tonight, we're going to go down with me leaving every little bit of energy that I had on the floor," James said.
Tim Duncan scored 30 points for the Spurs, his most in an NBA Finals game since Game 1 in 2003, but was shut out after the third quarter. He added 17 rebounds.
Game 7 will be here Thursday, the NBA's first do-or-die game to determine its champion since the Lakers beat the Celtics in 2010.
"They're the best two words in sports: Game 7," Heat coach Erik Spoelstra said.
The Spurs looked headed to a fifth title in five chances when they built a 13-point lead with under 4 minutes left in the third quarter, then grabbed a five-point edge late in regulation after blowing the lead.
But James hit a 3-pointer and Ray Allen tied it with another. Just 5.2 seconds remained in regulation. The Heat were that close to the edge.
James was just 3 of 12 after three quarters, the Heat trailing by 10 and frustration apparent among the players and panic setting in among the fans.
Nothing to worry. Not with James playing like this.
He finished 11 of 26, even making a steal after his basket had given Miami a 101-100 edge in the OT.
Before that, he was 12 minutes from hearing the familiar criticisms about not being able to get it done, from having to watch a team celebrate on his home floor again.
Then he changed the game and erased that story.
The Heat, who haven't lost consecutive games since Jan. 8 and 10, had too much defense and way too much James for the Spurs in the final 17 minutes. They are trying to become fourth team to win the final two games at home since the NBA went to the 2-3-2 format for the finals in 1985.
James came in averaging 31.5 points in elimination games, highest in NBA history, according to a stat provided through the NBA by the Elias Sports Bureau.
This wasn't quite the 45-point performance in Game 6 of last year's Eastern Conference finals in Boston, but given the higher stakes may go down as more important — if the Heat follow it with another victory Thursday.
The Heat were in the same place as they were in 2011 at the end of their Big Three's first season together, coming home from Texas facing a 3-2 deficit in the finals.
This is a different team. And oh, what a different James.
They said they welcomed this challenge, a chance to show they how much mentally tougher they were than the team the Dallas Mavericks easily handled in Game 6 that night.
James made sure they did, looking nothing like the player who was so bad in the fourth quarters during that series.
He was simply unstoppable down the stretch of this one.
Kawhi Leonard had 22 points and 11 rebounds for the Spurs. Tony Parker had 19 points and eight assists, but shot just 6 of 23 from the field.
The Spurs had one final chance down 103-100, but Chris Bosh blocked Danny Green's 3-pointer from the corner as time expired.
Bosh had said Green wouldn't get open the way he has all series — and he didn't.
Green finished 1 of 5 from behind the arc after going 25 of 38 on 3-pointers (65.8 percent) in the first five games.
The Heat, the NBA's 66-win powerhouse during the regular season, will be playing a seventh game for the second straight round, having needed to go the distance to beat the Indiana Pacers in the Eastern Conference finals.
"See you in Game 7!" the public address announcer hollered as Heat fans either left with or tossed their usual white T-shirts that hang on chairs in the arena. These read "First to 16 Wins," meaning the number of victories it takes to win the championship.
The race will go down to a final day.
The Heat are 13-0 after losses over the last five months, though this was nothing like the previous 12 that had come by an average of nearly 20 points. Nor was it like the previous four games of this series, which had all been blowouts after the Spurs pulled out a four-point victory in Game 1.
San Antonio had an 11-0 run in the first half, then a 13-3 burst in the third quarter for a 71-58 lead, and a final flurry late in regulation that seemed to have them ready to walk off with another title.
Parker's 3-pointer over James tied it at 89 with 1:27 left. He then came up with a steal, spinning into the lane for a 91-89 lead with 58 seconds to go. Miami coughed it up again and Manu Ginobili made two free throws, and he made another after a third straight Miami turnover to put the Spurs ahead 94-89.
James nailed a 3-pointer with 20 seconds left, and the Heat had one more chance after Leonard made just one to give the Spurs a 95-92 edge. James missed but Bosh got the rebound out to Allen, the league's career leader in 3-pointers, who made another one from the corner to even it up.
The Spurs went ahead by three again in overtime, but James found a cutting Allen for a basket, then scored himself to put the Heat on top. They clinched it when Bosh blocked San Antonio's final two shot attempts.
Bosh finished with 10 points and 11 rebounds.