HOUSTON (AP) -- Tracy McGrady returned and the Houston Rockets held on to a fourth-quarter lead against the defending NBA champions on Saturday night.
Maybe the Rockets' season isn't slipping away just yet.
Yao Ming had 21 points and 14 rebounds, and Houston beat San Antonio 83-81, the Spurs' fourth loss in six games.
"What I could see was effort and how much we wanted this game," Yao said.
Rafer Alston added 16 points and six assists as the Rockets beat their in-state rivals for only the fourth time in the last 13 meetings. McGrady, who was back after missing 11 games with a sore left knee, had nine points on 4-of-12 shooting.
"We not only played hard, we played smart and under control," McGrady said. "We played together as a team."
Tim Duncan had 24 points and 17 rebounds for San Antonio, which lost in Houston for the second time in six visits. The Spurs outrebounded Houston 37-32, but went a costly 11-for-19 from the free-throw line.
"You put yourself in a position to win," Duncan said, "but it didn't happen."
The Rockets led by 12 early in the second half, but appeared headed for their third straight fourth-quarter collapse.
Houston led 80-79 when Luther Head missed a reverse layup and Yao rebounded and dunked. He was fouled by Fabricio Oberto and pumped his fist after the whistle, with 2:24 to go.
But Yao missed the free throw and Duncan maneuvered for a layup at the other end to cut Houston's lead to 82-81. The Spurs had a chance to take the lead in the final minute, but Duncan missed a shot from the top of the key with 29 seconds left.
The Rockets played keep-away until McGrady found Yao underneath. Yao, an 86-percent free-throw shooter, got fouled, then missed both shots. Shane Battier rebounded the second miss and Alston hit a free throw with 2.4 seconds remaining.
Out of a timeout, Spurs reserve Matt Bonner missed a midrange shot at the buzzer.
"There were three or four options on the play," Duncan said. "Matty gets a wide-open shot and we'll take it. It just didn't go down."
The Rockets committed only seven turnovers, a season low for a Spurs opponent and the third-lowest single-game total in Rockets history.
"The thing we talked about was keeping our turnovers down," Alston said. "If we don't turn it over and give them easy baskets, that will help us out."
Manu Ginobili added 21 points and Tony Parker had 16 for the Spurs, who shot 45 percent (32-of-71), but took 12 fewer shots than Houston. The Rockets grabbed 16 offensive rebounds.
"Obviously, down the stretch, their extra effort on the boards and the bounces went their way," Duncan said.
McGrady was on the bench at the start and the Spurs hit six of their first seven shots. Head, McGrady's replacement in the lineup, kept the Rockets close with seven early points.
McGrady entered with 6:04 left in the first quarter. He missed his first shot, then scored on a drive and sank a 3-pointer to give Houston its first lead, at 19-18.
San Antonio controlled the boards in the first half, but committed eight turnovers that led to 14 Rockets points. The Rockets had 10 assists and only two turnovers at halftime and led 45-39.
Bonzi Wells scored twice as Houston stretched the lead to 55-43 early in the third quarter. The Spurs answered with an 18-6 run to tie it at 61 on Oberto's basket 15 seconds into the final quarter.
With Yao on the bench, Alston hit a 3-pointer and then picked off a pass and fed McGrady for a one-handed dunk on consecutive possessions to put Houston up 66-61. Rookie Carl Landry broke free for another dunk and fellow rookie Aaron Brooks sank a 3-pointer as Houston hung on to the slim lead.
Landry was called for goaltending when he blocked Duncan's hook and Duncan sank an easy bank shot as San Antonio closed to 75-74.
McGrady, wincing in pain during dead balls, left the game with 5:15 left and Parker promptly hit a jumper to put the Spurs in front. Luis Scola hit a free throw with 4:38 left to tie it and the Rockets pulled back in front on Alston's drive with 3:30 left.
Battier, Houston's best defender, came off the bench for the first time in two seasons with Houston, apparently to match minutes with top San Antonio reserve Ginobili. ... The Spurs listed no injured players for the first time in 18 games. ... Former Rockets center Hakeem Olajuwon had a courtside seat next to team owner Les Alexander. Duncan gave him a chest-bump hug before tipoff.