When the Magic took down the Mavericks by one point inside Kia Center on March 5, Orlando needed a last-second dunk from Wendell Carter Jr. to escape at home.

The second and final meeting of the regular season between the cross-conference foes at American Airlines Center went a bit differently Friday night.

Behind a season-high 28 points from Carter and a combined 92 from himself, Desmond Bane (27), Jalen Suggs (19) and Franz Wagner (18), Jamahl Mosley’s squad secured a much-needed 138-127 win on the road.

While those four led the way for the Magic, it was Dallas rookie and Montverde Academy grad Cooper Flagg who shined bright with a game-high 51 points in the 11-point loss. Flagg, 19, became the first teenage in league history to post a 50-plus point game.

Dallas coach Jason Kidd was ejected from the game less than two minutes into the fourth quarter after he continued to argue with the officials.

With the win, Orlando captured its first victory at Dallas (24-53) since Jan. 8, 2011 and swept the Mavs in the regular season for the first time since 1997-98.

Matching their win-total from a year ago with five contests still remaining, the Magic (41-36) wrap up their quick two-game trip Sunday at New Orleans in the first game of a back-to-back. Orlando hosts Detroit the following night.

Wendell’s way

The Magic center scored 13 of his 17 first-half points by remaining aggressive around the rim, getting to the free throw line and taking advantage of his matchup vs. Dallas big man Daniel Gafford.

Carter added nine points in the third quarter by knocking down his second 3-pointer of the night from the top of the key.

Knocking down all 10 of free throw attempts, he scored 20-plus points for just the fifth time this season. He totaled six rebounds and three assists.

Da Silva dynamic

Hitting his first 3-pointer of the night, Tristan da Silva notched seven points in the opening quarter and ended as the lone member of the Magic bench to score in double figures.

Ending 6 for 11 from the floor with three triples, the second-year pro finished with 19 points, five rebounds, one assist, one steal and one block.

Behind 23 points from Brandon Williams and 18 by Klay Thompson, the Dallas bench, however, outscored Orlando’s 44-36.

Free points

The last time these sides met in March, Orlando only took 16 total free throws.

On Friday, the Magic shot 21 free throws in the first half alone, of which they made 17 before the break.

Led by Carter and Bane (who shot 8 for 9), Orlando as a whole ended 30 for 37 at the charity stripe while Dallas shot 25 for 31.

Rookie watch

Flagg played well beyond his years when he knocked down a career-high five 3-ponters against the Magic. The showing marked his third time this season scoring 40-plus points.

And he did more than just score at a high rate. The No. 1 pick who spent a year at Duke added six rebounds, three assists and three steals in 34 minutes of action.

Neither Magic rookie Jase Richardson nor Noah Penda saw the floor until the final two minutes of the game.

Jason Beede can be reached at jbeede@orlandosentinel.com