Nets forward Mikal Bridges is fouled by Heat guard Gabe Vincent...

Nets forward Mikal Bridges is fouled by Heat guard Gabe Vincent during the first half of an NBA game on Saturday in Miami, Fla. Credit: AP/Michael Laughlin

MIAMI — They finally did it.

The Nets got a win when they needed it most, ending their five-game losing streak with a convincing 129-100 win over the Miami Heat, the team they are battling with for the sixth and final playoff spot.

With nine games remaining, the victory puts the Nets (40-34) back in the sixth and final playoff spot, one half game ahead of the Heat (40-35).

It also gives them a much-needed confidence boost as over the past 10 days the Nets had fallen from fifth place to seventh.

“We were just dying for a win,” Nets coach Jacque Vaughn said.

“We wanted the guys to feel good for themselves. We want to respond emotionally and physically. For us to do it on the road, well that’s great.”

The Nets trailed by as many as 14 points in the second quarter, but took control of the game for good when they outscored the Heat 39-18 in the third.

Mikal Bridges led all scorers with 27 points and seven assists. Cam Johnson added 25 while going 5-for-8 from three-point range. Spencer Dinwiddie added 15 points, nine assists and seven rebounds.

Tyler Herro and Max Strus, who hit his first nine shots of the game, led Miami with 23 points each.

The Nets held the Heat to just 31 points in the second half as the Heat shot just 28.2% (11 for 39) over the third and four quarters. The tone was set early in the third quarter when the Heat scored just six points in the first eight minutes.

“It’s great hitting shots and getting stops,” Bridges said. “We were all into it.

“We could hear the bench going crazy. We all played for each other. We were all excited and playing together. We knew we needed this game.”

The Heat entered the game having won seven of their last 10 and looked supremely confident. Except for the initial three minutes of the game, they led the entire half and had compiled a double-digit lead by the middle of the second quarter.

The Nets, however, stayed within striking distance and then in the final two minutes made three three-pointers and outscored the Heat 13-5 to make the score 69-65 at the half.

“We all felt good going into the half,” Vaughn said. “We felt like we had taken a punch and come back up.”

Their success from downtown carried over into the third quarter as the Nets hit four of their first five three pointers en route to taking a 79-71 lead at the 8:50 mark.

There had been a lot of talk about the Nets’ sagging morale entering the game, given that they were coming off a brutal loss to Cleveland on Thursday. The Nets, who had an eight-point lead with 1:53 left in the game, committed three turnovers in the final 1:18 and ended up losing, 116-114.

Bridges said Saturday morning that the team understands how important this game and ever game is down the stretch and that he is not worried about the group’s morale.

“I feel like the morale is always fine,” he said. “The locker room is the last thing we worry about.

“It’s just like everyone is competitive. You just get frustrated when we lose. The morale never changed in the locker room. It’s like everyone is all together and we all care about each other.”

Notes & quotes: Edmond Sumner, who had 12 points, had to leave the game early after hurting his hip. He will be evaluated Sunday . . . Seth Curry (personal issues) was not with the team and will also miss Sunday’s game in Orlando.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME