LaMarcus Aldridge had 24 points in his return from injury and the San Antonio Spurs withstood Luka Doncic's 38 points to beat the Dallas Mavericks 119-109 on Tuesday night and keep their playoff hopes afloat.
Doncic added seven rebounds and seven assists in 36 minutes. Tim Hardaway Jr. added 20 points.
Dallas remains seventh in the West, 6 1/2 games ahead of Memphis.
The Spurs moved four games behind the Grizzles for the eighth seed in their bid to earn an NBA-record 23rd straight playoff appearance.
A San Antonio crowd that has had little to celebrate about during the franchise's worst season in more than two decades found plenty to cheer about in the fourth.
The Spurs tied the game at 71 due in part to Hardaway getting heated at the officiating. Hardaway was assessed a technical foul by Tre Maddox with 5:54 remaining in the third for arguing a palming call against him that preceded a shooting foul against him on Bryn Forbes' 3-pointer.
Hardaway responded by scoring five straight points and yelling at the crowd in celebration after San Antonio was forced to call timeout.
The Spurs regained the momentum, taking their first lead at 88-85 a minute into the final quarter on Gay's 3-pointer. San Antonio extended that lead to seven points over the next minute. Marco Belinelli's 3-pointer pushed the lead to 101-90 with 7:24 remaining.
San Antonio held Dallas to five points on 1-for-8 shooting over the first five minutes of the fourth quarter.
The Spurs were without Dejounte Murray and Jakob Poeltl, but Aldridge returned from a six-game absence caused by a sore right shoulder. Aldridge opened the game shooting 2 for 7 but finished 10 for 23.
Mavericks: Hardaway picked up his fourth technical of the season and 10th of his seven-year career. ... Willie Cauley-Stein missed the game with an illness and Seth Curry sat out with a sprained left ankle. In all, Dallas had five players out with an injury or illness.
Spurs: Murray was diagnosed with a strained right calf after Sunday's loss in Cleveland, which surprised the Spurs staff. "I thought he bumped knees or something like that," San Antonio coach Gregg Popovich said. "Yeah, it was a little bit of a surprise. ... The Spurs have had nine players combine to miss a total of 32 games this season after having 10 players miss 170 games last season.
Mavericks: Host Denver on Wednesday night.
Spurs: Host Denver on Friday night.