Altuve recorded his first career four-hit game and scored runs in the first and second innings while Martinez drove in three runs, with two coming on an eight-inning double that put the Brewers ahead 7-4.
Astros reliever Wilton Lopez (2-0) pitched the sixth inning and collected the win while Brett Myers had a 1-2-3 ninth for his third save.
Houston increased the lead in the eighth when Jordan Schafer singled and took third on Altuve's double. Martinez followed with a single that got both runners home.
The Brewers got a Corey Hart home run -- his sixth of the season -- in the eighth for the final run.
Altuve singled and scored on a Martinez double in the first but Ryan Braun answered with a two-run home run -- his fourth of the year -- in the bottom of the inning.
The Brewers went up 4-2 in the second. Altuve singled and scored and Martinez walked and scored to key the inning. A home run by Travis Ishikawa in the second and Braun scoring on a wild pitch in the third tied the score 4-4.