The Miami Heat did not want even to think about going back to Boston for a Game 6, yet the Heat could not seem to shake the Celtics on Wednesday. Why, for most of the night’s Eastern Conference semifinal game, Miami couldn’t even catch up. The Celtics led by six with just more than four minutes to play after back-to-back jump shots, and Miami’s crowd sat quietly.

The experienced, defensive-minded, championship-minted Celtics looked primed to upset the Heat on its home court. Until LeBron James took matters into his own hands. He led an incomprehensible blitz, a three-minute barrage, almost single-handedly carrying the Heat to a 97-87 victory , a 4-1 win in the best-of-seven series and a spot in the Eastern Conference finals.

James scored the Heat’s last 10 points and led Miami’s game-ending 16-0 run as the Celtics, who shot better than 50 percent for the first three quarters, suddenly went dry.

“Down the stretch, LeBron was simply sensational,” Heat Coach Erik Spoelstra said, adding later, “I’ve never seen anything like it.”

James, who finished with 33 points, hit a pair of three-pointers, stole a ball, jammed home a dunk and scored in traffic in the final 2 minutes 10 seconds, unleashing what had seemed minutes before to be an unlikely celebration. James fell to his knees and clutched his head when the buzzer sounded, then he and Dwyane Wade shared a long embrace.

“They pushed us every game, every play, every minute,” James said. “If we made a mistake, they made us pay for it. . . . It was just very emotional at that point, happy we got through it as a team.”

The Celtics had knocked both the Heat and James’s former team, the Cleveland Cavaliers, out of last year’s playoffs. They took the Los Angeles Lakers to seven games in last year’s NBA Finals, and had beaten Miami in their first three meetings this season.

“It took a 51 / 2-month season to get to this point, to exorcise these tremendous demons for a lot of us,” Spoelstra said. “All season long, we weren’t really ready for this fight.”

Wade scored 34 points for Miami, including 23 in the first half, and Chris Bosh added 14 — including a critical fake-and-jam around Kevin Garnett with less than three minutes remaining. No other Heat player scored more than five points.

“To go against those two guys [James and Wade], they were superb,” Boston Coach Doc Rivers said. “Those two guys are monsters. When they’re making shots, it makes it really difficult.”

The Celtics got 18 points from Ray Allen, 15 from Garnett and 12 from Paul Pierce.

“They played a great series,” Allen said. “They tested us. Definitely they did. I take my hat off to them. . . . [James and Wade] lived in our paint. They scored a load of points inside our paint.”

The Heat also passed its first major playoff test after having endured a season of criticism and disdain from around the league after James, Bosh and Wade all decided to sign with Miami last summer. James’s much-derided announcement of his decision to join Miami made him the focal point of the attacks.

“I’ve never seen a team more criticized in my life,” Rivers said. “I didn’t like it. I thought it helped them. . . . It allowed them to go through something. It prepared them for the playoffs. I said to our coaches, ‘I wish people would leave them alone.’ ”

The Heat took its first lead since just minutes into the game late in the third quarter. After Wade stole the ball and took it the length of the court for a layup that tied the score, he hit a free throw to put Miami up, 66-65, with 3:12 left in the period.

But Allen answered 20 seconds later with a three-pointer — one of four the Celtics hit in the third quarter — to reclaim the lead. Miami hit three three-pointers of its own, as both teams shot around 53 percent from the field in the third quarter. They played even in the period, each scoring 24 points. Boston entered the fourth up, 73-71.

“We was right there on the cusp,” Wade said. “We couldn’t get over the hump, though.”

The Celtics sprinted to a seven-point lead with nine minutes remaining, and led by six with 4:29 left. But a three-point shot by James Jones with 3:43 left brought Miami within two, and a jam by Bosh tied it up. Miami then took the lead for the first time in the fourth quarter, 90-87, on a three-point shot by James with 2:10 left.

As it turned out, he was just getting started.

“From there, this guy to my right,” Wade said, gesturing to James, “just went off.”

After a timeout, Boston blew a pair of chances to get back in the game. Rajon Rondo missed a driving layup and then, after the Heat missed a pair of shots at the other end, Jeff Green failed to hold on to a hard pass by Pierce. The ball rolled out of bounds.

With a three-point lead and the clock winding down, James dribbled the ball at the top of the key before stepping back for another three-pointer with 40.4 seconds left. Miami was up by six.

Coming out of a timeout, James then stole a pass intended for Pierce near midcourt, looked back as if expecting a foul — or some company — and finished the play with a dunk with 30 seconds left.

After another Celtics miss, James finished the scoring binge with a layup in traffic with just over six seconds remaining as Heat fans went wild.

“I play with the two best players in the league, and we do this together, “ Bosh said. “We all need each other. . . . I look forward to the journey ahead.”