The Nets outscored the Magic 29-14 in the fourth quarter, forced five more minutes of action at Barclays Center and took a 103-101 lead with 5.3 seconds left in overtime Wednesday night when rookie Egor Demin hit his fifth 3-pointer of the game.

It felt like a moment of déjà vu, less than 24 hours after Orlando fell on the road at Washington and just a week after Paolo Banchero made a layup with 7.5 seconds left in regulation to lift his team past the lowly Pacers.

Were the Magic about to blow yet another double-digit lead to a team with a worse record than them?

Banchero, yet again, had other plans.

After Brooklyn‘s Michael Porter Jr. (game-high 34 points) fouled him because the Nets (11-23) had a foul to give, the Magic inbounded the ball to Banchero again and this time, he got a shot off.

The Magic forward banked in a buzzer-beating 3-pointer to deliver a 104-103 overtime victory and was swarmed by his teammates while silencing the Barclays Center.

“When you look up on the clock and you see three seconds left, you know that there’s still a chance,” Banchero said when asked what was going through his mind before the game-winner. “Even though it is a tough instance where he makes that shot and the crowd’s going crazy — it’s easy to give into that — you’ve just got to come to the bench and have that same belief you can win the game.”

And win the game he did.

His shot was the fifth buzzer-beating 3-pointer in Magic history, the second this season and the 19th buzzer-beating shot overall in team history.

Much like how Desmond Bane delivered an early birthday present to Banchero when he drilled a 3-pointer at the buzzer to beat the Trail Blazers two days before the Magic forward turned 23, Banchero’s shot came on Noah Penda’s 21st birthday Wednesday.

“The biggest part of this is we go the win on Noah Penda’s birthday,” Magic coach Jamahl Mosley said with a grin. “That’s big time.”

Orlando, which improved to 7-2 in games decided by 3 points-or-fewer this season, is hoping the team can ride the wave of momentum that comes with such a finish, similar to Bane’s game-winner in mid-November.

It was the team’s fourth win by one point, tying the franchise record (previously set it 1995-96 and 2004-05).

“It just keeps creating the resiliency that we know this group has,” Mosley said. “It’s building for the future for what we’re going to go through. These guys are continuing to learn these lessons about what we need to do down the stretch, to start games (and) to come together. It’s big for us as we continue to move forward.”

Added Penda: “Every time we win, we’re just super happy because that’s what we play for. Having wins on the road is a great feeling. Especially the way we played tonight offensively, I thought we were great. We were sharing the ball very well so that’s just a great feeling.”

The French forward, who recorded a double-double with 13 points and 11 rebounds while playing crucial minutes down the stretch at Brooklyn, isn’t wrong about Orlando’s success moving the ball around.

The team improved to 14-5 when recording 28 or more assists.

Still, Orlando has alternated wins and losses the past 11 games and still hasn’t won consecutive games since Nov. 28-Dec 1. It also last lost two in a row Dec. 13-18 against New York and Denver.

It’s a stretch that’s coincided with the absence of forward Franz Wagner, who missed his 14th game in a row Wednesday due to a left high ankle sprain. All-Defensive guard Jalen Suggs has also missed 10 of the past 12 games first with a left hip bruise and then a right knee MCL bruise.

But players such as Wendell Carter Jr., Anthony Black, Penda and Banchero have stepped up to help fill the void on both ends.

Wednesday’s contest marked the sixth time in Banchero’s career he’s recorded 30-plus points, 10-plus rebounds and five-plus assists in a game, an amount that ranks fourth all-time in team history.

The last six games Banchero has averaged 25.8 points on 40.9% shooting from distance with 10.2 rebounds and 5.8 assists in 35.3 minutes per night.

“It’s always good to win,” he said. “That’s the main thing, is just getting the win. We made the game a little closer than we would have liked, but as I said, getting the win is what matters.”

The Magic (21-17) are aiming to win consecutive games for the first time in more than a month when they host the Sixers at Kia Center on Friday. Philadelphia (20-15) has won four of its last five.

Taking better care of the ball would help, too. Banchero was responsible for nine of the team’s 18 turnovers when Orlando only improved to 4-5 when committing that many in a game this season.

“It’ll be great to be back home,” the Magic forward said. “I’m sure everybody’s excited about that.”

Injury update

Wagner and Suggs remain out for Friday’s game, as does Moe Wagner, who continues to rehab his left knee. Rookie Jase Richardson, who missed Wednesday’s game due to a sore left ankle, is questionable.

Jason Beede can be reached at jbeede@orlandosentinel.com

Up next …

Magic vs. Sixers

When: 7 p.m., Friday, Kia Center

TV: FanDuel Sports Network Florida