Cleveland Cavaliers’ Kyrie Irving (2) drives against Boston Celtics’ Marcus Smart (36) in the second half of an NBA basketball game, Thursday, Dec. 29, 2016, in Cleveland. (AP Photo/Tony Dejak)

CLEVELAND (AP) — LeBron James accepted “Happy Birthday” wishes as he walked out of Cleveland’s locker room

He was in no mood to party after his final game as a 31-year-old.

“I was horrible,” he said.

Kyrie Irving scored 32 points and made two critical layups before leaving with a hamstring issue and Kevin Love scored 30, helping the Cavaliers hold off a late rally for a 124-118 victory over the Boston Celtics on Thursday.

The Cavs led by 20 points in the third and 18 at the start of the fourth but couldn’t close out the Celtics, who pulled within one point three times in the final two minutes. But the NBA champions made plays down the stretch and won for the eighth time in nine games over Boston.

“We were still able to keep our composure even when it was down to a one-point and made timely shots,” James said.

However, the league’s best all-around player was upset with how he played despite nearly recording a triple-double. He committed eight turnovers, including one inexcusable miscue to aid Boston’s rally.

“I was pretty bad and it’s unacceptable and I can’t do that if I want to help our team get to where I want to get to,” James said. “As a report card, I give myself an ‘F’ for tonight’s performance. I’ve got to be better.”

Irving bailed out his more celebrated teammate by coming up with his big baskets. But he was forced to leave and the Cavs had to fend off Boston over the final 53 seconds as their star guard grabbed his right hamstring and went to the bench.

Afterward, Irving said his hamstring tightened up and he received treatment. Irving said he won’t know until Friday if he’ll miss any time.

James apologized to his teammates following the game, but Irving said that wasn’t necessary.

“That guy is so special,” Irving said. “He gives himself an ‘F’ and he still ends up with 23, 8 and 11. He took full accountability just like anyone else in this locker room would, but as the leader of this team, we demand a lot from him. He understands that, he wants it, he thrives in that and I think it’s good.”

Isaiah Thomas scored 31 and Avery Bradley had 23, but both players were on the bench when the Celtics’ reserves kept chipping away in the fourth. Bradley and Thomas then both made layups as the Celtics twice got within a point, but Irving countered on consecutive possessions for Cleveland.

Boston was down 120-118 with a chance to steal it, but Jae Crowder missed a 3-pointer with 8.5 seconds left and the Cavs finally sealed it as Richard Jefferson and Love knocked down two free throws apiece.

“I thought it was good. I had a good look at it,” Crowder said. “My coaches had confidence in me to make that. I’ll step into it a 100 more times.”

Following the Cavs’ emotional win over Golden State on Christmas — a rematch of the past two NBA Finals — James was given the next night off in Detroit and Cleveland was thumped 106-90. The loss dropped the Cavs to 4-18 without James the past two years and raised questions about whether they can survive without him.

On Thursday, they won without him at his best.

“I was happy that I got two All-Stars alongside me,” James said.

TIP-INS

Celtics: Thomas has scored at least 20 points in 17 straight games, the league’s longest current streak. … Bradley jammed his left thumb during the first half but returned. … Stevens’ wife is from the Cleveland area, and on a recent trip to Columbus for a wedding he got to see an Ohio State football practice. Stevens was an assistant at Butler under Buckeyes basketball coach Thad Matta. “He’s got some pull down there, it seems like,” Stevens said. “So we sat over there. They’re pretty impressive. My dad went to medical school at Ohio State. It’s pretty cool to follow their success.”

Cavaliers: Love added 15 rebounds. … Cleveland is 10-0 against the Atlantic Division. … James (721) moved past Bingo Smith (720) for the third-most games in franchise history. Only Zydrunas Ilgauskas (771) and Danny Ferry (723) have played more.

DON’T CALL IT A COMEBACK

Boston coach Brad Stevens didn’t take any solace in his team’s rally.

“If they have 100 points after three quarters, you don’t have a real chance to beat them,” he said. “We’ve got to play a lot better than that.”

UP NEXT

Celtics: Host Miami on Friday. Boston is 2-0 against the Heat this season.

Cavaliers: At Charlotte on Saturday, with a 7 p.m. starting time that conflicts with James being able to watch Ohio State play in the national football semifinals.