The Orlando Magic secured their 40th win of the season on Wednesday night by defeating the short-handed Boston Celtics 96-76 at Kia Center.

Franz Wagner led all scorers with 23 points, extending his streak of 20-point games to 12.

Cole Anthony provided a major spark off the bench, tallying 18 points on 5-of-10 shooting from beyond the arc.

With the victory, Orlando locked in the seventh seed in the Eastern Conference and homecourt advantage for the first round of the play-in tournament.

Boston, already assured of the No. 2 seed, rested its top six rotation players including Jayson Tatum, Jaylen Brown, Kristaps Porzingis, Derrick White, Jrue Holiday and Al Horford.

The Celtics managed just 76 points on 39 percent shooting and hit only 7 of 40 attempts from deep, setting a new season-low in scoring.

Baylor Scheierman and Payton Pritchard scored 15 points apiece to lead Boston, while Luke Kornet added 14 points and three rebounds.

Orlando’s defense held the visitors to just 15 points in the fourth quarter and forced 15 turnovers on the night.

Paolo Banchero finished with 15 points and six assists while also playing a key role during the Magic’s 20-4 run in the third quarter that broke the game open.

That surge turned an eight-point advantage into a 24-point cushion, fueled by three-pointers from Wagner, Gary Harris and Caleb Houstan, plus Banchero’s aggressive drives.

Anthony Black contributed six points, five rebounds, and two steals in 33 minutes, while Goga Bitadze and Cole Anthony each grabbed eight boards.

The Magic outrebounded Boston 49-43 and hit 16 three-pointers on 35.6 percent shooting from long range.

With the win, Orlando also clinched the Southeast Division title, their first since the 2018-19 season.

Boston, who defeated New York in overtime the previous night, opted to sit its regular starters on the second night of a back-to-back.

The Celtics fell to 33-8 on the road this season, with two of those losses coming in Orlando.

Kentavious Caldwell-Pope started but left the game early with a sore left knee and did not return for the second half.

Despite missing several rotation players themselves, including Jalen Suggs, Moritz Wagner and Jonathan Isaac, the Magic held the Celtics under 80 points for the first time this season.

The Purple and Gold now await the conclusion of the regular season to find out who their opponent will be in the play-in round.

A win in that game would earn the Magic a first-round playoff series against the same Celtics squad they just defeated.

Boston will close out its schedule having lost just one of its last nine contests but will hope to be back at full strength when the playoffs begin next week.

Scheierman logged 35 minutes in just his second NBA appearance and added five rebounds and three assists.

Pritchard handed out 10 assists but shot just 1-for-7 from three-point range.