HOUSTON (AP) -- Barely alive in the race for the final playoff spot in the Western Conference, the Houston Rockets focused on the one outcome they could control Saturday night.
Courtney Lee scored 20 points, Goran Dragic added 18 points and seven assists and the Rockets snapped a six-game losing streak with a 99-96 victory over the Golden State Warriors .
"We needed this win, so we could get that bad feeling off our backs," said Luis Scola, who had 13 points. "We really, really needed it."
Chase Budinger added 11 points for the Rockets, who came into the game in the 10th spot in the West, one game behind Utah and Phoenix.
Minutes after their game ended, the Rockets tuned in to the start of the Orlando-Utah game as they dressed and prepared for the trip to Miami, where they will play the Heat on Sunday.
"We've been thinking about games and possibilities for all these six games. It didn't work," Scola said. "We've got to go to Miami and win one basketball game and hopefully, just hopefully, at the end of the day, we'll still have chances."
Only two weeks ago, Houston had its fate in its hands after a four-game road winning streak. The Rockets came home and lost to Utah and Phoenix, then dropped a home-and-home set against Denver, another team in the bottom half of the standings.
The Rockets lost road games at Dallas and New Orleans this week, and struggled with the lowly Warriors, who have lost eight in a row.
"We needed to find a way to win one," Houston coach Kevin McHale said. "It was just one of those games, we weren't sharp and we made some 3s to get some separation out of them. But it was another one of those games where we really weren't at the top of our game."
Klay Thompson scored 24 points and Brandon Rush added 19 for the Warriors, who have lost 20 of their last 24. The team announced earlier in the day that Andrew Bogut and Stephen Curry would undergo surgery on their injured ankles.
Golden State coach Mark Jackson used only eight players and liked their effort.
"I was really proud of my guys," Jackson said. "We were short-handed, but put ourselves in position down the stretch to win the ballgame."
The Warriors got within two points midway through the fourth quarter, but Lee hit two 3-pointers to help Houston close it out.
Lee made his third 3-pointer and Patrick Patterson banked in a jumper to put Houston up 93-86. But Patterson missed an uncontested dunk, and Rush converted a three-point play to draw Golden State close again. Lee swished a corner 3 with 2:38 remaining, but Rush broke inside for a dunk and Thompson hit a floater to close the gap to two.
Budinger made a free throw with 1:07 remaining, and Dragic picked off a bad pass from Richard Jefferson with 50 seconds left. Patterson grabbed a late offensive rebound and tipped in a miss by Dragic with 7 seconds left to finally put it away for Houston.
"Breath of fresh air," Patterson said. "We haven't had a win in a long time."
The Rockets made 14 of 26 shots in the first quarter to lead by as many as 12 points. They continued to shoot well to start the second and also controlled the boards early, after getting outrebounded in five of its previous six games.
Houston finished with a 40-36 edge in rebounds.
McHale cited poor defense as a factor in the Rockets' recent slide, and the Warriors hit several open shots in the second quarter to keep pace. Rush hit a 3 and Charles Jenkins made two free throws to draw Golden State within five, and the Rockets started to worry that they were letting another one slip away.
Golden State scored the final six points of the half from the free-throw line and trailed 58-55. Rush had 13 points and Jenkins had 12 in the first half, while Scola led Houston with 11.
Notes: The Rockets scored 13 points off 18 Golden State turnovers. ... Houston held the Warriors to eight offensive rebounds and nine second-chance points. ... Jenkins scored 16 points. ... The Warriors have lost eight straight games in Houston since December 2007.