DALLAS (AP) -- Gregg Popovich is glad NBA games are 48 minutes long.
His San Antonio Spurs needed every last one Wednesday night.
The Spurs spotted the Dallas Mavericks an early 19-point lead, clawed back to even in the fourth quarter, then survived a see-saw finish for a 105-101 victory.
Davis Bertans and DeMar DeRozan scored 17 of the Spurs' 30 points in the fourth quarter, with Bertans hitting a go-ahead 3-pointer with 1:41 left. The Spurs blew a six-point lead in the final period, but Bertans made his third 3-pointer of the quarter for a 99-96 lead, and San Antonio led the rest of the way.
''We spotted them 12 minutes and didn't really compete, just followed them around,'' said Popovich, whose team was behind 23-4 just eight minutes into the game. ''I thought in the second, third and fourth quarters, we competed.''
Bertans finished with 12 points. Six Spurs scored at least 12 points, led by Marco Belinelli's 17.
After Bertans' 3, LaMarcus Aldridge scored on a tip shot with 1:07 left to extend the lead to five. Wesley Matthews' 3 brought Dallas within two, but DeRozan hit a 20-footer at the other end and Belinelli sealed it with free throws.
DeRozan finished with 14 points and nine assists, scoring or assisting on nine of the Spurs' 12 field goals in the final quarter.
''I get caught up in just trying to find guys while my first natural strength is to score the ball,'' DeRozan said. ''It was on me to be aggressive first and try and score, then make reads from there.''
Luka Doncic led Dallas with 25 points, adding eight rebounds and eight assists. He became the first rookie since Stephen Curry in 2010 to score 25 or more points in five straight games.
''Every day I know the league more,'' Doncic said. ''At the end of the day, it's just basketball.''
After trailing by 19 during the first half, San Antonio tied it at 80 on Belinelli's driving layup with 11:06 to play. DeRozan gave the Spurs their first lead 27 seconds later, setting up a three-minute stretch in which the lead changed hands seven times.
DeRozan hit back-to-back mid-range jumpers for a 94-90 lead, and he fed Aldridge for a dunk that extended the Spurs' advantage to six. Doncic answered with two baskets and an alley-oop pass to DeAndre Jordan that tied it.
Dallas has lost five of seven, and three of its last four at home after losing only three of its first 18 at American Airlines Center. The Mavericks are also 0-6 in games without J.J. Barea, who is out for the season after Achilles tendon surgery.
SMITH OUT AGAIN
Mavericks guard Dennis Smith Jr. missed his fourth consecutive game amid trade rumors, this time with coach Rick Carlisle saying Smith was sick and away from the arena. Smith missed the previous three games with what was listed as back tightness.
Told of a Twitter exchange between Smith and a couple in a restaurant at lunch earlier in the day, Carlisle said, ''I don't have any knowledge of that. My trainer told me he was sick and he's going to be out tonight. I've told you what I'm going to tell you about it.''
DONCIC TO DIRK
The 19-year-old Doncic assisted on both of 40-year-old Dirk Nowitzki's field goals - a pair of 3-pointers. They were the first two times Doncic assisted on baskets by Nowitzki.
''I knew he was going to make it when I passed to the corner (for the first 3),'' Doncic said. ''It was very special.''
15K FOR RUDY GAY
San Antonio's Rudy Gay reached the 15,000-point mark en route to 14 points after missing the last five games with a sprained left wrist.
''Individual things, it is what it is,'' Gay said. ''I'm past that. Right now, I'm just trying to win. Early in my career, I wanted these things. I just realize that things are more feasible when you don't worry about it.''
Spurs: Belinelli came back after missing one game with a left knee contusion.
Mavericks: The team sold out its 700th consecutive regular-season game, dating to Dec. 15, 2001. ... Matthews became the sixth player in Mavericks history to make 600 3-pointers when he drained one at 9:06 of the first quarter.
Spurs: At Minnesota on Friday.
Mavericks: At Indiana on Saturday.
More AP NBA: https://apnews.com/NBA and https://twitter.com/AP-Sports