The Nets' Jarrett Allen dunks the ball against the Magic's...

The Nets' Jarrett Allen dunks the ball against the Magic's Bismack Biyombo at Barclays Center on Monday, Jan. 1, 2018. Credit: Jim McIsaac

The Nets tipped off the New Year with a resolution to try to end their bad habit from 2017 — losing second games of back-to-backs.

After falling on New Year’s Eve in Boston, they took the court against Orlando on Monday night at Barclays Center and started 2018 off right. The Nets held the Magic to 36.5 percent shooting and emerged with a 98-95 win to open a five-game homestand.

It marked the first time they won the second game of a double dip since Cleveland’s visit on Oct. 25.

“Coach [Kenny Atkinson] talked about it before the game, about how everybody makes that a point that we don’t win (the second game of) back-to-backs,” Caris LeVert said. “So I think today was a huge game for us. Hopefully, we come out with the same energy [on Wednesday].”

LeVert contributed 15 points and eight assists. Rookie center Jarrett Allen paced the Nets with a career-high 16 points, 10 on dunks. Allen Crabbe had 15 points, eight rebounds and a career-high three blocks. And DeMarre Carroll delivered 14 points and 10 rebounds.

“Great resiliency,” Atkinson said. “We weren’t great offensively, but we did it with our defense.”

Aaron Gordon powered Orlando with 20 points and 12 rebounds. Bismack Biyombo also contributed a double-double with 13 points and 17 rebounds. But the injury-plagued Magic fell to 12-26, losing for the 22nd time in its last 26 games after an 8-4 start.

“We’re not executing down the end and we’re letting these games go,” Gordon said.

This game was tied for the 15th time at 95, after Elfrid Payton scored for Orlando on a layup with 47.1 seconds left. Carroll went 1-for-2 from the line to put the Nets ahead with 34.5 seconds remaining. Evan Fournier missed a three, and Carroll grabbed the rebound.

Payton fouled Crabbe at the 18-second mark, and he made both for the 98-95 advantage. Crabbe stuffed Fournier’s three-point attempt with 7.3 seconds to go and D.J. Augustin came up a short on the Magic’s final try to tie, missing a three from the left corner at 1.9.

“I’m just trying to take more pride in it,” Crabbe said of the defensive end. “People have questioned my defense.”

Carroll had nailed a three for the Nets, tying it at 85. But Gordon and Payton followed with a jumpers around Rondae Hollis-Jefferson’s missed fadeaway. Orlando led 89-85. There was 3:44 left.

But the Nets hung in there. The 6-7 LeVert drove on the 6-9 Biyombo and turned it into a three-point play for a 95-93 lead with 1:03 showing on the clock.

“I just tried to make a play, tried not to settle,” LeVert said.

The Magic settled for a 48-47 edge at the intermission. The teams traded the lead nine times in the third, which ended with the Nets up 71-70.

“Everybody knows we’ve got a day off after a back-to-back, so I think we all just came with energy tonight,” Crabbe said. “We had to get this win and start the New Year off right.”

More Brooklyn Nets