McDonald (9-7) allowed one run on three hits and three walks while fanning six, in leading the Pirates to their third win in four games.
Derrek Lee clubbed an opposite-field solo home run over the right-field wall late in the game to provide a cushion for Pittsburgh, which took the opener of a three-game series.
Bucs closer Joel Hanrahan ran into trouble in the ninth but closed out the game to earn his 35th save.
Houston's Henry Sosa (2-3) pitched six innings, surrendering two runs on six hits to absorb the loss.
The Astros suffered their fourth straight setback despite a run-scoring triple from Jose Altuve.