BOSTON (AP) -- The Cleveland Cavaliers had already erased a 22-point deficit when LeBron James grabbed a rebound with 10 seconds left and raced down the court.
Two to tie. Three to win.
James tried for the 3.
The Cavaliers forward scored 20 of his 42 points in the fourth quarter, but he missed two free throws in the final 16 seconds and a pair of 3-point attempts as the Boston Celtics withstood the Cleveland comeback for a 117-113 victory Sunday.
" It's tough to question anything he does,'' Celtics coach Doc Rivers said. " It felt like he scored their last 60 points in a row at one point. And who didn't think that was going in when he shot it?"
Ray Allen scored a season-high 33 points, hitting his sixth 3-pointer to give the Celtics a four-point lead with 48 seconds left, and Rajon Rondo scored 16 with 14 assists to help Boston snap a three-game home losing streak.
The Celtics and Cavaliers finished the season series tied 2-2.
A game that seemed like it might be a pleasant distraction from Sunday night's Red Sox opener against the hated New York Yankees turned into a full-scale playoff preview, a technical foul-filled, down-to-the-wire cage match between one of the NBA's top stars and one of its greatest teams.
Six technical fouls were handed out - two to Cavs coach Mike Brown, who was ejected. James got one and was spared another when he lingered in the Celtics' huddle during a timeout to exchange words with Tony Allen.
" We don't like them. They don't like us. So I wasn't surprised at all,'' James said, citing the seven-game playoff series Boston won in 2008 on its way to its 17th NBA title. " It comes from them wanting to be really great, them winning the championship, us wanting to win the championship and having to come through Boston to try to win it.
" The competition - that's what's good about this game."
Kevin Garnett, who was fined $25,000 for comments about the officials' treatment of Kevin Durant last week, also had words with James but declined to elaborate on what was said.
" Nothing in particular that I want to share or that the NBA wants me to share,'' Garnett told reporters. " Y'all are trying to cost me another 25."
The Cavaliers, who have won 17 of their last 20, earned home-court advantage throughout the entire postseason later Sunday when the Los Angeles Lakers lost to San Antonio. If the standings hold and the favorites prevail, the Celtics and Cavaliers would meet in the second round of the Eastern Conference playoffs.
The Cavs scored 23 of the first 28 points in the fourth quarter to erase 17-point deficit, taking their first lead at 104-103 with 2:58 left. James missed one of two free throws with 16 seconds to go, then did it again with 11 seconds to play before misfiring on 3-point attempt with 3.2 seconds left when Antawn Jamison was open for a 2-pointer that would have tied it.
" LeBron is a great player and we're lucky to have him,'' Brown said. " Guys, in order to be great, have to have a lot of confidence. You have to have confidence to take big shots, and at times take some risks. ... If he felt like he had a clean look at it, fire away."
James was 0 for 9 from 3-point range, including a meaningless, unguarded shot at the final buzzer that bounced off the rim. Afterward, he and Garnett exchanged dirty looks.
" It's two teams that I don't think love each other, I can say that, and there's two teams that want to beat each other,'' Rivers said. " Early on, we were having out way, so they got frustrated. And later they were having their way, so we got frustrated."
Garnett scored 19 points, Paul Pierce had 16 and Kendrick Perkins had 10 points and 10 rebounds. Jamison scored 16 points with 10 rebounds for Cleveland, and J.J. Hickson had 14 and 11. Mo Williams scored 17 points for Cavs, hitting all of his six shots - including three from 3-point range - but did not play in the fourth quarter.
The Celtics led by eight in the opening minutes and 15 at the half when Rondo, after taking an inbounds pass with 2.5 seconds left, hit a 3-pointer at the buzzer. Boston led 98-81 at the end of three before scoring three points in the first seven minutes of the fourth.
The Celtics snapped out of it just in time.
When Rivers wasn't trying to figure out how to stop the Cavs, he was trying to keep order on his own bench. Forward Rasheed Wallace picked up a technical foul with 50 seconds left in the third quarter - his 14th of the season, according to the NBA - and began yelling at Rivers when the coach took him out.
Wallace did not return to the game.
Brown was ejected after drawing two technicals midway through the third quarter. He picked up the first when he argued about a technical given to Williams for arguing a non-call, then angrily stormed onto the court and was quickly tossed by referee Monty McCutchen.
Ray Allen shot the free throws and made all three, giving Boston an 83-62 lead.
NOTES: Celtics F Glen Davis went into the stands twice for crowd-pleasing attempts to save the ball. ... James and Rondo also picked up technicals.