McGrady and Yao led the Rockets back from a seven-point deficit in the fourth quarter to an 85-82 win on Sunday night.
Yao scored a season-high 34 points, including a pair of free throws with 20.4 seconds left to put Houston in the lead, and McGrady had 12 of his 26 points in the final period as the Rockets won their third straight game.
"I don't think there's a better 1-2 combination ... they might be the best combination since MJ (Michael Jordan) and (Scottie) Pippen," Bobcats forward Gerald Wallace said. "Tracy is a great offensive player ... and Yao Ming is basically what they call him, the Great Wall of China. Once he gets the ball, he's pretty much unstoppable."
Yao and McGrady combined to hit 22-of-35 from the field and 15-of-17 from the free throw line for Houston, which saw its decisive 47-34 rebounding advantage offset by 20 turnovers. That made for a close game, with 15 lead changes and nine ties.
"This was a game that we should have lost, because we didn't play particularly well," McGrady said. "It just goes to show how good we can be. ... We found some way to keep ourselves in the game. When it mattered the most, myself and Yao brought it home."
Matt Carroll scored 17 points for the Bobcats, who saw their two-game winning streak snapped. Jason Richardson and Raymond Felton had 16 points each, Wallace scored 10 and Emeka Okafor finished with 12 points and 11 rebounds.
Carroll's 3-pointer gave Charlotte a 74-67 lead with 6:07 remaining, but McGrady scored nine points during an 11-4 run that tied the score at 78 with 1:24 left.
"Down the stretch, we did what we had to do," Rockets head coach Rick Adelman said. "We made some stops and executed. Tracy was terrific down the stretch and Yao was good the whole game, but we have to be a lot better offensively than we were tonight."
Richardson hit a driving layup to put the Bobcats back on top 80-78 with 1:07 remaining, but McGrady made a 3-point play 13 seconds later to give the Rockets the lead again.
Charlotte took its last lead with 38.1 seconds remaining on a pair of Felton free throws, but Yao snagged Rafer Alston's missed 3-pointer and drew the foul, setting up his game-winning free throws.
"I saw the ball come to me," Yao said. "I said, 'I cannot let this go.' I was in perfect position. I couldn't let this chance slip away.
"We need to train much stronger or I'll get a heart attack or something. This was the closest game of our season, and we'll have more. We have to prepare for that."
The Bobcats had a chance to reclaim the lead, but Wallace was called for an offensive foul on his drive to the basket. Mike James then hit two more free throws with 2.3 seconds left to give the Rockets a three-point lead, and Shane Battier swiped the inbounds pass to seal the win.
"It was a tough finish," Felton said. "It didn't go our way, but that's how it happens sometimes. We played a great game. We're not satisfied with the result, but we're satisfied with the way we played."
The two sides swapped the lead five times and tied the game four other times during the first quarter and the opening minutes of the second period, but Richardson and Carroll keyed a 25-19 run that put the Bobcats ahead by as many as 10 points before going up 40-35 at the break.
- Houston reassigned second-year forward Steve Novak to the team's developmental league affiliate in Rio Grande Valley, Texas, on Sunday. He has been inactive in the Rockets' first six games this season. Novak appeared in 35 games in 2006-07, averaging 1.5 points and 0.7 rebounds.
- Houston guard Steve Francis, who has not played in the Rockets' first six games, did not accompany the team to Charlotte due to what a spokesperson said was an excused "family problem."
- The Bobcats wrap up their three-game home stand against the Miami Heat on Tuesday night, while the Rockets play the Memphis Grizzlies to end a two-game road trip that same night.