DALLAS, March 23 (Ticker) -- The best shot of Jason Richardson's career spoiled a near career-best for Dirk Nowitzki.

Richardson scored 40 points and hit a spinning, leaning 3-pointer as time expired as the Golden State Warriors stole a 122-121 victory from the Dallas Mavericks, who wasted a season-high 51 points from Nowitzki.

NBA TV highlights from
Richardson's remarkable shot capped a stunning comeback from a six-point deficit in the final 35 seconds. It came one possession after teammate Derek Fisher had a tying 35-footer waved off because it came after an intentional foul.

"We were down by two but I thought we were down by three," Richardson said. "I didn't know, I was just trying to get a shot up. When it went in I just thought we were going to overtime, then realized that we had won. It was a shocker. I was excited about it."

"We had it in our hands and then he makes a spin move, double-pumps, goes under me and shoots a three, off-balance, on one leg and makes it," said Mavericks guard Darrell Armstrong, who scored 10 points. "Congratulations!"

Nowitzki fell two points shy of his career high. He made 16-of-24 shots and 16-of-17 free throws, although the lone miss from the line helped Golden State's comeback.

"When he's making those midrange jumpers, he's nearly impossible to guard," said Mike Dunleavy, who had 21 points, eight rebounds and five assists. "The guys 7-1. You tip your hat to him, he's a hell of a player. Fortunately for us we got the win."

As a team, Dallas had made its first 31 free throws but was only able to make three of their last six, finishing 35-of-38 from the stripe.

"We missed some big free throws down the stretch," Nowitzki said. "DA (Armstrong) missed one, I missed one, Jet (Jason Terry) missed one."

"They shot 100 percent from the free-throw line for 47 minutes and 30 seconds and then missed three in those last 30 seconds," Fisher said. "You have to just keep playing basketball and eventually the ball will bounce your way."

Armstrong made two free throws to give the Mavs a seemingly safe 116-110 advantage with 35 seconds left. But Fisher made a jumper five seconds later and Nowitzki split a pair of foul shots.

Fisher missed a 3-pointer and Nowitzki gathered the rebound. But Fisher made a steal, leading to Troy Murphy's 3-point play that cut the deficit to 117-115 with 18 seconds left.

"We were up five and I had the rebound," Nowitzki said. "I don't know what I was thinking. I tried to dribble the ball out of the pack. Then they got a three-point play. Everything kind of went wrong, that could have gone wrong in that last minute."

Armstrong went 1-of-2 from the line and Richardson and Jerry Stackhouse traded a pair of free throws, leaving Dallas with a 120-117 lead. Fisher raced upcourt and was fouled by Jason Terry before firing a long 3-pointer that went in but did not count.

"I guessed right that he was going to have to foul," Fisher said. "I heard Avery telling them if (Armstrong) makes it and we're up three to foul. It's a guessing game between the offense and defense because if you jump up and they don't foul you your taking a bad shot."

Fisher netted two from the line with five seconds left, nearly missing the second one.

"I thought about (missing it on purpose)," Fisher said. "I really did but we didn't have any timeouts and I didn't want to miss it and them get the rebound and be able to put us in a position where the only thing we were going to be able to do was have to make a three. I went ahead and decided to make it, but I think because of my thought process, it still kind of hit the rim a little bit and then it rolled in."

Terry split a pair with just 4.7 seconds to go. Richardson corralled the rebound, dribbled through defenders into the frontcourt, spun and launched a runner that banged in at the buzzer.

"He's (Richardson) hit a lot of big shots for us through the years," Dunleavy said. "He thrives in those situations so I wouldn't say we expect him to make those shots, but we're not surprised when he makes them."

Richardson made 14-of-23 shots - including 5-of-10 from the arc - and three steals. Fisher had 17, seven assists and six steals for the Warriors, who improved to 1-1 on their three-game road trip.

"It was huge," Richardson said. "I get the shot off and it was a big game, probably the best in my career. To win a game like this was huge for this team. We really needed it."

Terry had 29 points and seven assists for the Mavericks, who lost for just the second time in their last 21 home games. However, it was a costly one as Dallas (53-16) fell one-half game behind San Antonio for the best record in the Western Conference.

The Mavericks lost both home meetings with the Warriors on last-second shots. On December 30, Baron Davis buried a 20-footer with five-tenths of a second remaining for a 111-109 win.

"It's a great place to play," Richardson said. "The fans are into the game, you're playing against the top power forward (Nowitzki) in the league, there's a lot of things about this arena that make us like playing in it."