The Athletics survived a shaky ninth inning to move from a half game behind to a half game ahead of Texas at the top of the American League West.
Oakland had to overcome an early 3-1 deficit to down the Astros, who had been trying to defeat the A's for the fourth time in five meetings.
The Athletics trailed by a run heading into the fourth, but Coco Crisp drew a one-out walk and moved to second on a single by Donaldson.
Jed Lowrie's base hit brought in Crisp to tie the score and Donaldson scored from third later in the inning on a groundout by Yoenis Cespedes.
Donaldson came through with his sixth-inning homer after Crisp had opened the inning with a triple.
The win was collected by A.J. Griffin (13-9), who gave up four runs on seven hits with nine strikeouts in six innings.
Dallas Keuchel (5-9) was tagged with the loss after lasting only 3 1/3 innings. He allowed five runs on 10 hits.
Grant Balfour recorded his 37th save despite giving up an unearned run in the ninth. Houston had runners on second and third when Balfour struck out Matt Dominguez to end the game.
Martin Bashir resigns from MSNBC over Sarah Palin comments
Exploding whale video goes viral on Internet