After the Tigers tied the game at five on an RBI single by Tyler Collins in the top of the eighth inning, the Astros quickly picked up two outs in the bottom of the ninth.
Houston outfielder Jake Marisnick then tripled to right field off Tom Gorzelanny, setting up the chance for Altuve to end the game at Minute Maid Park. Alex Wilson took over on the mound for Gorzelanny after the triple.
It was the third walk-off hit of Altuve's career.
Altuve, 25, finished the day 3-for-5 and is now hitting .302 with nine home runs and 50 RBIs on the season.
The Astros (64–54) currently hold a three-game lead over the Los Angeles Angels in the AL West.