MIAMI — The plan that Miami coach Erik Spoelstra had entering Friday was to play Tyler Herro in limited shifts, mindful that he was just coming back after a six-game absence.

Herro had other ideas.

Herro came off the bench to score 27 points in 29 minutes, Jimmy Butler added 25 and the Heat beat the Minnesota Timberwolves 121-112 on Friday night to move a game clear of Boston in the race for the No. 6 spot in the Eastern Conference.

“The best laid-out plans are getting tossed to the side at this time of year," Spoelstra said. “He's got young legs. You can see that he had fresh legs."

Goran Dragic added 23 points for Miami, which — thanks largely to Herro and Dragic — held a 57-19 edge in bench points. Herro, who had been out with right foot soreness, was 10 of 13 from the field and 6 of 8 from 3-point range for Miami (36-31).

“It's playoff time," Herro said.

The win, combined with a loss at Chicago by Boston (35-32), allowed the Heat to pass the Celtics in the standings. Miami opens a two-game series in Boston on Sunday, the teams battling to avoid having to be part of the play-in tournament that awaits the teams finishing between No. 7 and No. 10 in each conference.

Karl-Anthony Towns scored 14 of his 27 points in the fourth quarter for Minnesota, which had won five consecutive meetings against Miami. Anthony Edwards scored 25 points and D’Angelo Russell added 17 before getting ejected in the third quarter.

“No matter what the standings say, no matter how many games are left, we're out here trying to build something great," Towns said.

Butler also had eight rebounds, six assists and five steals for Miami. Bam Adebayo scored 15 for the Heat, which moved within one game of No. 4 New York (37-30) and a half-game of No. 5 Atlanta (37-31). The Knicks lost in Phoenix on Friday night.

Minnesota was up by as many as 11 in the first quarter, then lost the lead in the second — and its cool in the third.

The Timberwolves — upset with calls and non-calls — were hit with four technical fouls in the third quarter, the first on coach Chris Finch just 72 seconds after halftime, then simultaneous ones on Ricky Rubio and Russell with 5:27 left in the period. Russell got another and was ejected 52 seconds later.

“It was very frustrating out there for everybody, certainly in a white uniform," Finch said. “We tried to play through it the best we could. Obviously, we lost our cool a little bit, and understandably so."

Miami got that early deficit down to four by the end of the first, then outscored Minnesota 61-46 in the middle two quarters. It was only a seven-point Heat lead with 2:14 left, but back-to-back 3's by Dragic and another one from Herro in a 59-second span sealed things for Miami.

“I'm not worried about the points," Dragic said. “I want to be back in the playoffs. That's the most important thing."

TIP-INS

Timberwolves: Alex Rodriguez, the former MLB slugger who, along with e-commerce mogul Marc Lore, signed a letter of intent last month to buy the Timberwolves and keep them in Minnesota, was sitting courtside. ... Rubio finished with 16 points.

Heat: It was the 14th time this season that Miami got into a double-digit deficit in the first quarter, with the Wolves going up by 11 in the opening period Friday. The Heat are now 7-7 in those games. ... Miami fouled a 3-point shooter on three different occasions, including one that Towns turned into a four-point play. ... Victor Oladipo (right knee soreness) remains sidelined. He hasn't played since April 8, or 15 games ago.

HELPING JIMMY

Butler took all four free throws awarded after Minnesota technicals, making three. The last time a Heat player had more technical free throws in a game was March 16, 2014, when Ray Allen was 5-for-5 against Houston. Butler and Towns got matching technicals in the final minute as well, with no free throws awarded.

MORALE BOOSTER

Before getting on the plane Thursday for the final trip of the season, the Timberwolves were all given floppy hats — always good in Florida — and veteran Ed Davis was gifted Finch’s suite for the two-night Miami stay.

“We want these guys to finish strong,” Finch said. “They’re playing pretty well on the floor, they’re doing a lot of things we’re asking them to. We want them to also enjoy being part of this organization, enjoying each other and any way we can break it up, make it a little bit more lighthearted, we like to try to do that.”

UP NEXT

Timberwolves: Visit Orlando on Sunday, the next-to-last road game of Minnesota’s season.

Heat: Visit Boston on Sunday, the start of a two-game, three-day trip against the Celtics.

___

More AP NBA: https://apnews.com/hub/NBA and https://twitter.com/AP_Sports