James missed nine of his first 12 shots, but scored 16 points in the fourth to rally the Heat from a 10-point deficit. The Heat trailed 94-89 with 28 seconds to play, but James hit a 3 with 20 seconds to go and Allen drilled another to tie it.
James' layup with 1:43 to play in overtime gave the Heat a 101-100 lead, and Allen added two free throws to force Game 7, which is on Thursday night in Miami. The Spurs had one final chance down 103-100, but Chris Bosh blocked Danny Green's 3-pointer from the corner as time expired.
Tim Duncan had 30 points and 17 rebounds in a performance straight out 2003. But he was scoreless in the fourth and overtime and the Spurs squandered a golden opportunity to close out the series and win their fifth championship.
Mario Chalmers scored 20 points, Bosh had 10 points and 11 rebounds and Shane Battier hit three 3-pointers for the Heat, who trailed 75-65 after three quarters.
James eschewed his trademark headband in the fourth quarter, then spearheaded the ferocious comeback. He scored six straight points for the Heat, then fed Chris Andersen, who made a free throw to pull the Heat within two at 82-80 with seven minutes to play.
James then blocked a layup by Duncan and scored on the other end to tie it and Allen's reverse layup gave the Heat an 84-82 lead with six minutes to go.
The Heat led 89-86, but Tony Parker hit a step-back 3 and a layup to take back the lead.
After Allen's big shot from the corner sent the game into overtime, James scored on a layup for a 101-100 lead with 1 minute to go. The Spurs had a chance to take the lead in the closing seconds, but Manu Ginobili's drive was thwarted and Allen hit two free throws.
Bosh blocked Danny Green's 3-pointer at the buzzer, and the defending champs lived to fight another day.
Parker finished with 19 points on 6-for-23 shooting and eight assists and Kawhi Leonard had 22 points and 11 rebounds for San Antonio. Green, who broke the NBA Finals record for 3-pointers, had just three points on 1-for-7 shooting.
After a vintage first three quarters from Duncan had the Spurs steamrolling toward the championship, James delivered a vintage performance of his own in the fourth. Tentative and flustered through the first three, James went into full-on attack mode in the fourth to force a Game 7.
It was the force-of-nature showing that had been all too rare for James in these finals, but the Heat have never needed it more after Duncan took it to them the first 36 minutes.
Duncan hit his first eight shots of the game, conjuring the dominant form that brought four titles to San Antonio between 1999 and 2007. But he long ago handed the reins of the Spurs offense over to Parker, letting the speedy French point guard take over as Duncan grew older.
Until Tuesday night.
After getting a vintage performance from Manu Ginobili in Game 5 to take control of the series, the Spurs got a throwback effort from Duncan to start Game 6.
With the Heat leading 40-33 and threatening to pull away with 7:30 to go in the first half, Duncan scored San Antonio's next 13 points to start a 17-4 run that gave San Antonio a 50-44 lead at halftime.
Duncan has never scored more points the first half (25) of a finals game in his career, a performance reminiscent of his 32-point, 20-rebound, seven-block game in Game 1 of the 2003 finals against New Jersey. But this one was so much more important.
They entered the game with title No. 5 sitting right there in front of them. They had two cracks to bring the trophy back home to San Antonio, but the last thing they wanted was to have to play a Game 7 against LeBron James on the road for the championship. There have only been five Game 7s in the finals since 1978, with the home team winning all those contests. The last road team to win a Game 7 for the title was the Washington Bullets over the Seattle SuperSonics in 1978.
Chalmers was 4 for 19 over his last three games, but came alive in this must-win for Miami. He made 5 of 7 shots, including two 3s, in the first half to get the Heat out quickly.
Wade seemed to tweak his left knee after being whistled for an offensive foul early in the first quarter, but he looked fine moments later when he dunked over Duncan to tie the game at 16.
It's been 12 games since the Heat have won two in a row, a startling stretch of inconsistency for a team that won 27 straight in the regular season and figured to turn this postseason into a coronation rather than a competition.
But the short-handed Chicago Bulls put up an inspired fight in the Eastern Conference semifinals, the Indiana Pacers took them the full seven in a rugged conference finals and the Spurs picked them apart in three of the first five games in this series.
For most of the last two months, the Heat have preferred to wait until they were in serious trouble before finding that extra gear that only they seem to have. Down 2-1 in the series, James, Wade and Bosh combined for 85 points to even the series.
It doesn't get any more serious than what the Heat faced when they walked into American Airlines Arena on Tuesday night.
One more uninspired performance from their three All-Stars, one more lazy night on defense, one more loss and the Heat were done for the season. The prospects of falling to 1-2 in NBA Finals appearances since James, Wade and Bosh united in 2010 loomed over a team that was constructed to win not just one title, but multiple crowns.
In the unflappable Spurs, the Heat may be facing their biggest challenge yet. Duncan, Parker and Ginobili have teamed to win three championships, so they know what it takes to deliver in the finals. And youngsters like Green and Leonard have shown that even when LeBron and Co. flex their muscle, like they did in Games 2 and 4, they come right back at them.
For as much as James and the Heat had riding on this finals appearance, the Spurs may have even more. Duncan is 37, while Ginobili will soon turn 36 and is in the final year of his contract, giving the feeling that after so many premature proclamations of demise for this core group.