J.R. Smith hit two free throws with 0.4 seconds remaining, lifting the Denver Nuggets to a 123-122 victory over the Golden State Warriors on Tuesday night.

Smith, one of four Nuggets to finish with at least 20 points, was fouled by Monta Ellis while throwing up a desperation 3-pointer after taking an inbounds pass with just 3 seconds remaining.

Ellis, who had 32 points for the Warriors, had given Golden State a 122-121 lead when he made a 10-foot turnaround jumper with 15.2 seconds to play.

Kenyon Martin had 27 points and 13 rebounds to lead the Nuggets, who were without injured stars Chauncey Billups, Carmelo Anthony and Chris Andersen. They also lost Ty Lawson to an ankle injury during the game.

Corey Maggette scored a season-high 35 points to lead Golden State, which lost its eighth straight on the road. Stephen Curry added 26 points for the Warriors.

Down by two entering the final period, the Warriors forged in front with an 11-0 run that put them up 113-109 with 4:10 remaining.

Smith connected on an 18-foot jumper to give Denver a 109-102 lead but Maggette hit a pair of free throws, Ellis drove in for successive layups and Curry hit a 3-pointer. Trying to break up the Warriors' string, the Nuggets' Lawson drove to the net but couldn't get a shot away in a traffic and dumped the ball off behind his back, falling hard on his left ankle. He limped off the court to the locker room and the team said he sprained his left ankle and would not return.

The Warriors picked up the loose ball and started a fastbreak that Maggette finished with a layup that gave the Warriors a 113-109 advantage.

With 1:51 remaining, the Warriors led 120-115 but the Nuggets scored the next six points, going in front 121-120 when Martin rebounded a missed shot by Joey Graham and put it back in. Ellis countered with his jumper seconds later to give the Warriors their final lead.

Graham missed a 3-pointer in the final seconds and a scramble for the ball led to a jump ball won by Aaron Afflalo, who got it to Smith. The Nuggets called a timeout with 1.4 seconds left before getting the ball in to Smith. Officials reviewed the call and determined Ellis fouled him with 0.4 seconds remaining. Smith hit the first two throws, missing his final attempt.

The teams traded baskets at a breakneck pace in the third, running and shooting and pretty much dispensing with defense. But neither could make a decisive move on the scoreboard, with Denver managing to take a 98-96 lead into the final period.