DALLAS (AP) -- Dirk Nowitzki scored 19 points, and the Dallas Mavericks avoided a potentially serious blow to their playoff hopes by rallying in the fourth quarter for a 103-100 victory against the Sacramento Kings on Saturday night.
The Mavericks blew a 17-point lead and trailed by five in the fourth quarter before recovering for their 20th straight regular-season win at home against Sacramento, the longest against any opponent in franchise history.
Dallas (44-30) is in a virtual tie with Memphis (43-29) for eighth place in the Western Conference, a half-game behind Phoenix. The Mavericks have eight games left and finish the regular season at the Grizzlies.
Rudy Gay scored 30 for the Kings.
Monta Ellis had 17 points and six assists and Sam Dalembert added 15 as Dallas avoided a second loss to a West also-ran on a franchise-record eight-game homestand that ends Tuesday night against Golden State, the fourth likely playoff-bound opponent in five games.
The Kings were up 89-84 after a jumper from Jason Thompson when Jose Calderon started a 10-0 run with a 3-pointer and Nowitzki hit a pair of free throws for a tie.
Shawn Marion made two more free throws to put Dallas back in front, then knocked down a 3-pointer from the right corner for a 94-89 lead. Marion finished with 14 points.
Sacramento had a chance to tie in the final seconds after Ellis missed two free throws, but Travis Outlaw's 3-pointer was short just before the buzzer.
Gay, who had 35 points in another close loss at the Mavericks in January, led Sacramento's push for its first regular-season win in Dallas since Feb. 27, 2003. The Kings won a playoff game in Dallas in 2004 when they eliminated the Mavericks in five games in the first round.
Gay tipped in his own miss for the Kings' first lead at 81-80 with 7:26 remaining in the game and muscled in a bucket after Ray McCallum missed a layup. Gay also had seven rebounds.
With Kings point guard Isaiah Taylor missing his third straight game with a right thigh contusion, McCallum became the first NBA player this season to go the full 48 minutes. He has played six straight quarters over two nights after going the entire second half of a loss at Oklahoma City.
McCallum, who had 16 points and eight assists, was briefly the only guard available when fellow rookie guard Ben McLemore left with an apparently leg injury. McLemore returned in the fourth.
Nowitzki led the Mavericks with seven rebounds and tied Calderon for the team lead with seven assists.
Reggie Evans had a season-high 18 rebounds for Sacramento, and DeMarcus Cousins finished with 17 points, seven rebounds and five assists despite sitting most of the third quarter with four fouls.
NOTES: Kings coach Michael Malone said Thomas might play Monday at New Orleans. ... Kings F Jason Thompson got a technical for complaining about a foul called against him on a three-point play by Marion. It contributed to a seven-point spurt in just 26 seconds that gave Dallas a 50-33 lead late in the first half. ... Ellis has been willing to take charges all season, never better illustrated that early in the third quarter when the 6-foot-11, 270-pound Cousins dribbled the length of the floor before plowing through the 6-3, 185-pound Ellis under the basket.
Copyright © The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.