MIAMI — Luka Doncic turned 21 on Friday, and the Miami Heat were determined not to give him and the Dallas Mavericks a gift-wrapped victory.

So after wasting another lead, the Heat found a way to rally.

Jimmy Butler scored 26 points, Duncan Robinson added 24 and the Heat scored the first 13 points of the fourth quarter to spark a 126-118 win over the Mavericks.

“Overall, we just needed to gut something out together, collectively against a really good team," Heat coach Erik Spoelstra said.

Goran Dragic and Kendrick Nunn each had 16 points for Miami. Bam Adebayo added 14 points and 11 rebounds for the Heat, who won for just the third time in their last 10 games.

“We stayed together through their runs," Butler said.

Seth Curry had a career-high 37 points for Dallas, shooting 13 for 15 from the field and 8 for 9 from 3-point range. Kristaps Porzingis scored 24 points and grabbed 13 rebounds, and Doncic — playing with an aching thumb — shook off a 2-for-9 start from the floor to finish with 23 points and 10 assists.

“I couldn't catch the ball,” Doncic said. “I didn't know how important the thumb was to hold the ball. It was tough. ... I wasn't myself today. Just have to learn from that and move on.”

Kelly Olynyk finished with 13 points, seven rebounds and nine assists for the Heat, with six of those assists coming in a five-minute span of the final quarter when Miami — which wasted a lead in the third — rallied.

With former Slovenian national teammates Doncic and Dragic going head-to-head, the Heat — as they did when Dallas visited last season — deemed it Slovenian Heritage Night, and there were hundreds of flag-waving fans from the European nation in the crowd. Some even wore specially designed T-shirts with Doncic and Dragic on the front, and the Slovenian flag on the back.

So the mood was festive, and even the non-Slovenian Heat fans liked how things looked when Miami took a 12-point lead in the third quarter.

And then yet another lead slipped away — or, in Slovenian, “še eno vodilo je zdrsnilo.”

For the fourth time in the last five games, the Heat saw a double-digit lead vanish. The Mavs needed only a stretch of 2:29 in the third to turn an 83-74 deficit into an 88-85 lead — a 14-2 spurt that was started by a 3-pointer from Curry and ended with another Curry 3.

“Seth was great," Mavericks coach Rick Carlisle said. “His shooting of the basketball has been phenomenal for a stretch here. That's definitely a positive.”

Dallas’ lead was 93-88 going into the fourth, before the 13-0 Heat run to open the final quarter put Miami back on top for good.

TIP-INS

Mavericks: Jalen Brunson (right shoulder sprain) is rehabbing and has told the team that he is feeling improvement, but there is no timetable for any possible return. ... JJ Barea, who went to high school in Miami and was a big part of the Mavs’ win over the Heat in the 2011 NBA Finals, played on the Heat home floor for the first time since Dec. 22, 2017.

Heat: Butler’s first basket of the third quarter pushed him to 1,000 points this season. He’s the 31st player to have a 1,000-point season in Heat history, and Adebayo is on pace to be the 32nd in the next few games. ... Heat legend Tim Hardaway, one of five players in team history with a retired jersey number, was in attendance to watch his son — the Mavs’ standout wing Tim Hardaway Jr., who had 15 for Dallas.

TURNING 21

Amid the celebrating of Doncic’s 21st birthday Carlisle was asked pregame if he recalled what he was doing when he hit that age on Oct. 27, 1980, when he was preparing for his sophomore season at Maine: “I don’t exactly remember, but I wasn’t going for my 22nd triple-double in a year and a half or whatever,” Carlisle said.

RECORD CHASING

Robinson extended his streak of games with at least one 3-pointer to 44, five away from Rafer Alston’s team record. Alston’s streak was most unusual: It spanned the final 48 games of the 2003-04 season, then restarted on Jan. 8, 2010 — the first game after he was re-acquired by the Heat as a free agent.

UP NEXT

Mavericks: Visit Minnesota on Sunday, the third game of a four-game trip. Dallas has another four-game trip looming in mid-March.

Heat: Host Brooklyn on Saturday, the first Feb. 29 home game in team history. Miami is 1-3 all-time on the leap year date, the last of those games a loss at Seattle in 2008.

___

More AP NBA: https://apnews.com/NBA and https://twitter.com/AP_Sports