Miami Heat forward Gerald Green, left, goes to the basket as Sacramento Kings center Kosta Koufos, right, looks on during the first quarter of an NBA basketball game Friday, April 1, 2016, in Sacramento, Calif. Rich PedroncelliAP

Miami Heat forward Gerald Green, left, goes to the basket as Sacramento Kings center Kosta Koufos, right, looks on during the first quarter of an NBA basketball game Friday, April 1, 2016, in Sacramento, Calif. Rich PedroncelliAP

But the Heat signed Green primarily for his sweet shooting stroke and ability to score in bunches. And on Friday, more so than anytime this season, Green offered up the ignitable vintage version of a mercurial player who was spectacular in preseason but often erraticsince.

Green’s 30 points powered Miami for three quarters, and the Heat survived a furious Kings rally to escape with a 112-106 win, a critical stand after Miami opened the road trip with an unexpected and particularly aggravating loss to the 16-win Lakers.

Miami’s magic number to clinch a playoff spot is now one – either one victory or one Chicago Bulls loss.

Never miss a local story.

Sign up today for a free 30 day free trial of unlimited digital access.

“Ultimately, down the stretch, three minutes to go, I just wanted to see us rise to the occasion,” Erik Spoelstra said of a game that turned harrowing late. “We got some defensive stops when we needed to.”

A maniacal Kings comeback sliced their 24-point deficit to one with 2:18 left.

After Kosta Koufos’ hard foul against Hassan Whiteside, Green picked up a technical when he walked toward Koufos.

Green said he never made a comment to the referee and was merely putting his hands up to motion for everyone to “get out of the way to make sure [Whiteside] was all right.”

Seth Curry hit the technical, pulling the Kings to within 103-102. Whiteside then hit two free throws, pushing the lead to three.

After the Kings again cut it to one, an 11-foot pull up from Joe Johnson made it a three-point game, and Luol Deng’s huge three stretched it to 110-104 with 46 seconds left. The Kings never again drew closer than four.

Before Friday, Green’s season high was 25, achieved on Nov. 27 against the Knicks. He had surpassed 20 points just twice all season.

But his timing Friday was fortuitous, became it came in the absence of Dwyane Wade, who sat out with back and neck soreness that he expects will also keep him out of Saturday’s game at Portland.

Starting for the 13th game this season, Green finished 11 for 19 from the field and 5 for 9 from three-point range. This was his 10th career 30-point game, but he fell short of his career high of 41 for Phoenix in March 2014.

Green, who scored all 30 in the first three quarters, said he has been motivated by critical things written about him, without specifying what.

Related stories from Miami Herald

“Every day I go to the gym, read comments, go right back to the gym, read comments, go right back to the gym,” he said.

This was undoubtedly the highlight of the season for Green, who began the year in the rotation but fell out of it since Joe Johnson’s signing.

Green had played just 45 minutes over the previous eight games and entered shooting just 38.3 percent overall and 31.4 percent on threes, well below his 36.1 career average beyond the arc.

“I hadn’t been playing well,” he said. “I’ve always had confidence in myself. I was missing shots the last two months.”

Green opened six for six, scoring 15 in the first quarter and going to the half with 20. He added 10 more in the third, reaching the 30-point mark on three free throws after being fouled by Rudy Gay on a three-pointer.

Green sat out the first 6:29 of the fourth, leaving with the Heat ahead by 16 and returning with Miami up three. He went scoreless over 4:16 fourth-quarter minutes, missing his only shot. Spoelstra said he told Green three weeks ago that “you’re the next guy. I love it because he’s done it with great work. Every single night he’s in there working, after games, staying ready, staying in shape. He’s the first guy on the floor before practice, the last guy to leave.”

Everyone with a meaningful role chipped in. Deng, who has played very well in the first two games of this road trip, delivered 17 points and 4 assists.

Goran Dragic had 18 points and 7 assists. Amar’e Stoudemire began the game with a dunk and closed with eight. Joe Johnson added 14 points, 8 assists and 5 rebounds but also had six of Miami’s 18 turnovers.

Justise Winslow added 12 points and five boards. Josh Richardson, coming off an 0 for 8 shooting game, hit one of two threes and 3 for 8 overall on a seven-point night.

And then there was Whiteside, who got some motivation before the game when Kings coach George Karl critiqued his shot-blocking.

Whiteside had three blocks and 13 rebounds in 30 minutes. He attempted only four shots from the field on a six-point night but hit the two big free throws late. He also had a couple of nifty passes, his two assists giving him 29 for the season.

While the Heat played without Wade, the Kings were without leading scorer and rebounder DeMarcus Cousins, who received his 16th technical foul, triggering an automatic one-game suspension, because he sarcastically clapped in the face of a referee late in Wednesday’s game against Washington.

The Heat, at 44-31, moved back into third in the East, holding a tiebreaker against No. 4 Charlotte, which is also 44-31, with both teams percentages points ahead of No. 5 Atlanta (45-32). Boston is in sixth at 44-32 after winning at Golden State on Friday.

Down 18-13, the Heat unleashed a blistering 29-6 run, including Winslow’s 28-foot running bank shot at the first quarter buzzer that put the Heat ahead 39-24 after one. Miami opened 22 for 28 from the field and led 66-48 at the half.

Down 92-76 after three, the Kings drew as close as one, fueled by Darren Collison (26 points), Gay (20) and Curry, who tied his career high with 21.

Whiteside said “it was good for us” to be challenged late.

Deng said “obviously you don’t want to give up a big lead, but it happens. It’s the NBA. Instead of playing a simple game, we rushed it a little. But after they made their run, we managed to keep the lead.”

But Dragic said the Heat must be “more focused” when it as a big lead. “It was a strange game because they blitzed every pick and roll,” he said. “They play fast.”

The Heat swept the two-game season series, having won116-109 on Nov. 19 in Miami. Cousins was suspended for that game, as well.

This was the Heat’s final game in suburban Sleep Train Arena, which opened in 1988 and was called Arco Arena for much of its