HOUSTON, Dec. 9 (Ticker) -- With a long losing streak against their Texas rivals, Tracy McGrady proved to be the difference for the Houston Rockets.

NBA TV highlights from
McGrady scored 13 of his 33 points in the final 35 seconds, including a game-winning 3-pointer with 1.7 seconds remaining as the Rockets snapped a seven-game slide against the San Antonio Spurs with an 81-80 triumph at the Toyota Center.

"We got a miracle," Houston coach Jeff Van Gundy said. "You need miracles over the course of a season."

"This really hasn't hit me," McGrady added. "I don't know how we won. I don't realize what I did. I can't tell you how many (3-pointers) I hit."

Tim Duncan made the second of two free throws with 1:02 remaining to give San Antonio a 74-64 lead, sending a large number of Rockets fans toward the exits.

"I noticed people leaving," Houston's Andre Barrett said. "We played the game for ourselves."

"Those fans that walked out, and there were thousands of them, they missed a great game," McGrady said.

Yao Ming tipped in a missed shot and Scott Padgett followed with a dunk to cut the lead to 74-68. The Rockets tried fouling, but Devin Brownmade four free throws around a 3-pointer by McGrady to keep San Antonio ahead, 78-71, with 31 seconds to go.

But McGrady answered again, drawing contact from Duncan while hitting another 3-pointer. He made the ensuing free throw to complete a four-point play and reduce Houston's deficit to 78-75 with 24 seconds left.

"I don't know how I got the ball up, Duncan's so tall," the 6-8 McGrady said. "But it fell for me. That shot got me going."

"It was a pump play by Tracy and I got up in the air and fouled him," said Duncan, who was forced to cover McGrady on a switch. "He just made tough shots."

Duncan widened the Spurs' lead to 80-75 with a pair of free throws eight seconds later. But McGrady responded with another shot from the arc with 11 seconds remaining, making it a one-possesion game.

After San Antonio's final timeout, Brown received an inbounds pass in the front court but slipped and turned over the ball while driving on the baseline.

"We didn't want to foul them when Devin Brown caught it," Van Gundy said. "Try to knock the ball free and, somehow, we got it."

"I was pushed in the lower back, but I can't dwell on that," Brown said.

McGrady scooped up the loose ball with seven seconds remaining and raced to the other end before pulling up at the top of the arc and burying the winning 3-pointer with just under two seconds remaining, giving Houston its third straight win and its first against San Antonio since December 3, 2002.

McGrady, who was acquired by Houston in the offseason, never considered playing for the tie.

"We were down two and the only thing I could think of was a 3-pointer," McGrady said. "I felt like anything I threw up was going in."

"I haven't seen anybody do something like that," Brown said. "He was just hitting shot after shot. He was fantastic."

McGrady, who had 17 points in the final quarter, shot 12-of-29 from the floor with eight rebounds and five steals.

"It was a great game and we got sloppy at the end," San Antonio coach Gregg Popovich said. "Tracy took advantage of it and was unbelievable. He's a great player."

"He's gifted," Van Gundy said. "He misses makeable ones and makes unmakeable ones."

Yao added 27 points and 10 boards.

"We're going to struggle to score right now," Van Gundy said. "We can't shoot. We're not tricking anybody. There's two around Yao and two around Tracy."

Duncan scored 18 of his 26 points in the second half and collected 18 rebounds for San Antonio. The two-time MVP also had seven of the Spurs' season-high 12 blocks.

Brown scored 20 points off the bench, including eight during a 15-2 run in the fourth quarter that gave the Spurs a 73-62 lead with 2:54 remaining.