MIAMI — This time, there would be no fourth-quarter meltdown.

Wayne Ellington made sure of that with a season-high 26 points.

The Nets, who have lost 13 games this season in which they were within a basket entering the fourth quarter, held on to beat the Heat, 111-105, on Monday night at AmericanAirlines Arena.

It was just the Nets’ third road win of the season — they are 9-22 overall and 3-12 away from home.

But all was not well early on. In fact, after the Heat (18-12) closed the first half on a 13-3 run to take a 58-44 lead, Nets coach Lionel Hollins was determined to make changes.

“It looked like we were dying,” Hollins said. “We need a spark. I had written down on paper that I was going to take all five starters out. But when I walked to the court, I re-thought that. I only took out the guards [Jarrett Jack and Bojan Bogdanovic].”

advertisement | advertise on newsday

Hollins inserted Shane Larkin — who played his college ball locally with the Miami Hurricanes — at the point and Ellington on the wing.

The move paid off immediately as Ellington scored 11 points in the third quarter, going 3-for-three on three-pointers.

“[Hollins] came into the locker room and said he wasn’t happy with how we finished the first half,” Ellington said. “He said he was going to make some lineup changes. Nobody knew exactly what it was going to be, but he wanted us to be prepared.”

Ellington, playing for his sixth team in his seventh NBA season, has never averaged as many as 11 points in a season. This season, he is averaging 5.2 points.

Yet, he seemingly could not miss in the second half when he scored 23 points in 24 minutes. His plus-minus rating was plus-20 in the second half and plus-15 for the game — no other player on the floor could equal either number.

Brooklyn Nets videos

For the game, Ellington made 9 of 18 shots, including 7 of 9 on three-pointers.

“He’s a fantastic shooter/scorer,” said Nets center Brook Lopez, who shared game-high honors with 26 points to go with 12 rebounds. “We need him to have confidence to put the ball up.”

Ellington had that confidence against the Heat, helping the Nets overcome a 16-point third-quarter deficit.

It was the third time in Ellington’s career that he has scored 20 or more points against the Heat.

Heat guard Dwyane Wade and forward Chris Bosh each had 24 points but Ellington’s defense was as important as his shooting. Case in point: Wade was held scoreless in the third.

advertisement | advertise on newsday

As a team, Miami was held to 29.4 percent shooting in the third quarter. Brooklyn shot 66.7 percent in the period, and Lopez matched Ellington’s 11 points in the quarter.

In the fourth quarter, the Nets led by as many as 11 points and then held on as the Heat made a final push.

Brooklyn’s 67 points in the second half is the most Miami has allowed this season.

For the game, the Nets outscored the Heat 27-15 in second-chance points.

The Nets, Bosh said, “pretty much got everything they wanted in the third quarter.”