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

Wayne Ellington made sure of that.

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 Miami 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.

Miami (18-12) had its two-game win streak snapped.

After trailing by as many as 16 points in the third quarter, Nets coach Lionel Hollins subbed out his starting backcourt and put in Shane Larkin at the point and Ellington on the wing.

Ellington scored 11 points in the third quarter, going 3-for-3 on three-pointers. He finished with a season-high 26 points. He tied Nets center Brook Lopez for game-high honors.

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

Lopez added 12 rebounds, and Nets starting point guard Jarrett Jack had 18 points.

Before the game, Hollins said his Nets might be better off if Miami center Hassan Whiteside — who was dealing with a flu bug — played.

“If he’s not in the paint, then they’re going to be small, and it would be tough for us to match up,” Hollins said. “At least when he’s in the game, we can match up better.”

Whiteside finished with 18 points, 11 rebounds and a game-high five blocks.

Heat guard Dwyane Wade and forward Chris Bosh each had 24 points. But the Nets comeback started in the third quarter, when Wade was held scoreless.

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

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.

Early on, it was all Heat.

Miami, which shot 55 percent in the first quarter, had a 26-24 lead. Brooklyn shot just 38 percent, but the Nets managed to stay within reach by outscoring Miami 7-2 on the foul line and 7-4 on second-chance points.

The Heat closed the first half on a 13-3 run, taking a 58-44 advantage into the break. The Heat shot 58.3 in the first half and held Brooklyn to 31.8 percent.

Wade was 5-for-5 from the floor and made 7-for-8 from the foul line for 17 first-half points. Bosh had 12 points and was a plus-14 while he was on the court.

The Nets outscored Miami 34-19 in the third period to take a 78-77 lead.

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

Ellington, who made 9 of 18 shots from the floor, including 7-for-9 on three-pointers, was plus-15 for the game. That was the best plus-minus for any player in Monday’s game.