When the Magic took down the Mavericks by one point at the 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.

“They did a great job of communicating with each other,” Mosley said about his team. “You talk about 35 assists, moving (the ball), sharing it, trusting the pass, playing with the right style of pace – really, they’re trusting each other.

“That was great to see,” he added. “Defensively, at moments, we were very good and then we had some lapses. … But at the end of the day, our guys did an unbelievable job of responding and playing for one another.”

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 teenager and the youngest player in NBA history to post a 50-point game.

Flagg also became just the ninth rookie in NBA history to post a 50-point game, joining Wilt Chamberlain, Rick Barry, Earl Monroe, Brandon Jennings, Elgin Baylor, Elvin Hayes, Kareem Abdul-Jabbar and Allen Iverson. None were teenagers when they reached the half-century mark. Jennings was 20 and the last rookie to put up 50, in 2009.

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 victory total from a year ago with five contests still remaining, the Magic (41-36) wrap up their quick two-game road trip Sunday at New Orleans in the first game of a back-to-back. Orlando hosts Detroit on Monday night.

Wendell’s way

Carter, 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 versus 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.

“His presence at the rim is great for us,” Mosley said about Carter. “He’s one of the most selfless guys we have because he’s just trying to do the right thing by this team.”

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 free throws.

On Friday, the Magic shot 21 free throws in the first half alone – making 17 before the break.

Led by Carter and Bane (who shot 8-of-9), Orlando finished 30-for-37 from the foul line 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.

“He’s very tough,” Mosley said about Flagg. “You can see his fire, his fight, his toughness, and he’s a hell of a player.”

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