The Spurs trailed by 10 points with five minutes to go but rallied to send Houston falling out of first place in the Southwest Division. A win by New Orleans over Portland earlier in the evening allowed the Hornets to move past Houston into the division lead.
Duncan hit a runner in the lane with a minute left to give San Antonio a one-point advantage and that is the way it still stood when he batted away a layup attempt by Aaron Brooks.
San Antonio's Roger Mason grabbed the loose ball and was fouled. He made one free throw to give the Spurs a two-point lead with two seconds left and then they survived a three-point attempt by Ron Artest just before the buzzer.
George Hill added 17 for San Antonio and Artest led the Rockets with 18. Houston's Tracy McGrady made just two of 12 attempts from the field and finished with seven points.