MIAMI — Miami Heat All-Star center Bam Adebayo scored 14 points and helped seal a 104-99 win over the Toronto Raptors on Monday night in his first game back after missing six weeks due to thumb surgery.

Tyler Herro poured in 23 points, while Jimmy Butler earned a triple-double with 19 points, 10 assists and 10 rebounds — the last of those coming as time was expiring, when Fred VanVleet‘s 3-point try missed.

“We’re just blessed to have a team like this,” Adebayo said. “Everybody buys in. Everybody wants to compete. And everybody wants to get the job done.”

Adebayo played 32 minutes, shooting 4 for 12 and grabbing nine rebounds. He also drained two free throws with 8.5 seconds left to make it a two-possession game.

“You can see his energy out there,” Heat coach Erik Spoelstra said after his team pulled into a virtual tie with Chicago for first in the Eastern Conference. “He makes us different.”

“I’m just happy Jimmy got the triple-double and we got the win,” said Adebayo, who ended up playing 32 minutes in his return and wore a wrap to protect his repaired thumb.

VanVleet finished with 22 points for Toronto, which got 23 from Chris Boucher and 18 points and 10 rebounds from Pascal Siakam. Scottie Barnes scored 16 points, OG Anunoby scored 14 and former Heat forward Precious Achiuwa grabbed 15 rebounds for Toronto.

Siakam scored off a turnover with 1:48 left to get Toronto within 99-96, but PJ Tucker made a corner 3 with 20 seconds left — off Butler’s 10th assist — to help Miami hold on.

Toronto basically used a six-man rotation, with those players getting between 34 and 42 minutes. The only other Raptor who got minutes was Justin Champagnie, who played 9:07 before leaving with a dislocated finger.

“We played as tough as we could,” Raptors coach Nick Nurse said. “I didn’t see anything that was changing. We were battling from start to finish. … That one could have went either way. It was a hell of an effort by our guys.”

The game was expected to be the first time that Heat guard Kyle Lowry faced the Raptors since leaving Toronto for Miami this past season. Lowry helped Toronto win the 2019 NBA title on his way to claiming to the unofficial moniker of GROAT — the Greatest Raptor Of All-Time.

Lowry missed the game for personal reasons.

“I wanted to see him, obviously,” Nurse said. “I guess I don’t know how I feel about it. I think that you go in here and you always want to compete against the best players. I was kind of looking forward to seeing what that was going to be like.”

Lowry missed a pretty good one.

There were 22 lead changes and 10 ties in the first 35 minutes, knotting the teams at 75 late in the third. Herro scored the last five points of the third quarter, then had the first bucket of the fourth to put Miami up by seven.

The Heat wouldn’t trail again. Anunoby made a 3-pointer with 6:57 left to get Toronto within two, but Miami scored the next seven points in a span of 59 seconds — a basket by Adebayo, a corner 3 from Max Strus and a driving layup by Caleb Martin for a 98-89 lead.

The Associated Press contributed to this story.