The result had major short-term ramifications in the Western Conference playoff race, with Golden State (38-36) not only advancing 1 1/2 games over Dallas (36-37), but also getting a decisive advantage by winning the series of the season. 2-1.
Jonathan Kuminga had a team-high 22 points off the bench, Draymond Green and Stephen Curry hit key hoops in the streak for the Warriors.
The game was tied at 120 all-around when Green pushed through the heart of the Dallas defense and went down in a layup while getting fouled by Christian Wood with 1:32 left.
After Green finished the game on three points, the Mavericks quickly replied with a wooden hoop to get within one, then had the opportunity to take the lead after a missed 3-pointer by Donte DiVincenzo.
But Luka Doncic missed on a 3-pointer, after which Curry drove for a layup that put Golden State back to the three-point lead with 8.5 seconds left.
After another miss from Doncic, on a lay-up attempt, Kevon Looney went down on two free throws with 1.7 seconds left as the Warriors capped a five-game winning streak trip after losing the first three games.
The closely contested game, in which neither team led by more than nine points, saw the Warriors go up 113-105 on a Kuminga dunk with 6:35 remaining.
But Dallas, looking to avoid a second straight loss, immediately came back with two 3-point hoops from Jaden Hardy and an inside field goal from Doncic in a 54-second flurry that forged a tie and set up a thrilling finish.
Curry finished with 20 points and a team-high 13 assists for the Warriors, who prevailed despite shooting just 12 for 39 from 3-point range and being outscored 51-36 beyond the arch.
Looney also recorded a double-double with 12 points and a game-high 12 rebounds, while Jordan Poole finished with 16 points, and Green and DiVincenzo 14 each.
Coming back from a five-game absence due to a strained thigh, Doncic paced the Mavericks with 30 points while finding time for a team-high 17 assists and seven rebounds. However, he only shot 11 of 27 overall and 2 of 10 from 3-point range.
Reserves Hardy and Wood had 27 and 19 points respectively for the Mavericks, who were missing Kyrie Irving with a right big toe injury. Reggie Bullock added 15 points, Dwight Powell 13 and Josh Green 12.
(With contributions from Reuters)