ORLANDO, Fla. — Franz Wagner scored 18 points, including the tiebreaking layup with 54 seconds remaining, and the Orlando Magic overcame Luka Doncic’s seventh triple-double of the season to beat the Dallas Mavericks 110-108 on Sunday night.

Chuma Okeke scored a season-high 19 points and helped Orlando win consecutive games for just the second time all season.

“I’m going out there and having fun and I’m realizing all the work I’m putting in after practice is paying off,” said Okeke, who had an open-court steal from Doncic late in the third quarter for a dunk. “I’m going out there confident, my teammates believe in me and I believe in myself.”

Doncic finished with 34 points, 12 rebounds and 11 assists for the Mavericks for the 43rd triple-double of his career, tying Fat Lever for 10th place in NBA history.

Down two in the final seconds, Dallas got the ball into the hands of Doncic, but he gave it up under defensive pressure with 5.5 seconds remaining. Maxi Kleber missed a 3-pointer from the corner. Reggie Bullock’s put-back try at the horn was strong and Dallas’ winning streak ended at two games.

“He did everything right,” Dallas coach Jason Kidd said of Doncic’s decision to give up the ball in the closing seconds. “That’s what champions do and leaders do — they trust that their teammates are going to make the right play and knock down a shot. When that happens and we move forward, it’s going to make the game so much easier for him.”

Said Doncic of his decision: “I’m not going to shoot over two because somebody is open. I think that was a good play and I’ll do it again.”

Dorian Finney-Smith had a chance to tie the game again after Wagner’s layup, but the Dallas forward converted just one of two free throws with 34 seconds remaining.

Kleber then rebounded a Wagner miss with 18.6 seconds remaining. Kidd said he yelled for a time out, but referee Bennie Adams didn’t hear him. Kleber had the ball stolen from him by Jalen Suggs, and Wendell Carter Jr. split two free throws to give Orlando a two-point lead with 16.8 to play.

“It’s an unfortunate play — with the mask (that Kidd was wearing) Bennie said he didn’t hear me call time out,” Kidd said. “That’s unfortunate, because our defense gave us a chance.”

Cole Anthony added 16 points and six assists for Orlando, while Carter added 14 points and 14 rebounds for his team-best 20th double-double of the season.

Jalen Brunson scored 15 points for Dallas, while Marquese Chriss scored 14 points off the Dallas bench.

Wagner, the NBA’s second-highest scoring rookie at 15.7 points per game, had six fourth-quarter points as the Magic rallied in the final three minutes of the game.

“Now, even when we have a couple of bad minutes, we picked it up a lot quicker and get back to how we’ve been playing,” Wagner said. “In these five (home) games we got back to what makes us really good.”

Dallas was playing less than 24 hours after beating Indiana 132-105 at home on Saturday. The Mavericks were without starting center Kristaps Porzingis, who didn’t travel because of a sore right knee.

Orlando entered Sunday 27th in the NBA in 3-point shooting, but made 9 of 16 tries from beyond the arc in the early going and led 64-59 at the half. Down by as much as 11 in the first quarter, Orlando outscored Dallas 41-25 in the second quarter.