DETROIT -- For five innings, the Houston Astros were one pitch away from blowing an important game.
Their relievers never gave the Tigers that pitch.
Five Houston relievers threw shutout innings, and the Astros' three early homers held up in a 5-4 victory over Detroit on Tuesday night.
"None of those guys had a margin for error," Houston manager A.J. Hinch said.
Houston maintained a three-game lead over the Oakland Athletics in the AL West.
Jose Altuve homered on the first pitch of the game, and the Astros hit two more homers in the first four innings to go up 5-0.
Houston starter Framber Valdez, though, couldn't maintain that big lead.
Valdez allowed four runs in the bottom of the fourth, including a three-run homer by JaCoby Jones. That ended his night and started a parade from the Houston bullpen.
Hector Rondon gave up two hits in the seventh but got out of the jam, and Collin McHugh and Roberto Osuna retired the last six batters in order. Osuna struck out rookie Christin Stewart to end the game and earn his 17th save in 18 opportunities.
"It's hard to pick which was my favorite reliever of the night, because they all came in and were effective," Hinch said. "The way the game started, I didn't expect a bullpen day, but I looked up and it was suddenly a one-run game."
Jordan Zimmermann (7-7) allowed five runs on six hits in five innings. He walked one and struck out three.
"I just didn't have my best stuff," he said. "My fastball command wasn't there, so my first pitch wasn't where I wanted it and Altuve's a great hitter. It seems like my starts lately have been very good or very bad."
Detroit got four scoreless innings from its bullpen.
"Those guys did a fantastic job of keeping us in the game," Tigers manager Ron Gardenhire said. "They've got so many great arms in their bullpen, though, and we could never get one more big hit."
After Altuve gave Houston the early lead, Tony Kemp hit a two-run homer in the second inning.
Tyler White hit Houston's third homer, a two-run shot into the Astros bullpen with one out in the fourth.
"We try to get runs any way we can," White said. "Altuve starting the game with a homer was an unbelievable way to get us going, and then Kempie came up with a big swing."
The Tigers scored all their runs with two outs in the fourth. With runners on the corners, Dawel Lugo hit what looked like a routine grounder to short, but the ball took a bad hop and went over Carlos Correa's head for an RBI single.
Jones then lined a 3-1 fastball into the left-field stands for his 11th homer of the season.
"I needed to refocus after the bad hop, because that's something I can't control," Valdez said through a translator. "It's just something that happens."
Jones came into the game hitting .183 with 51 strikeouts in his last 40 games but managed five homers during the slump.
"He can always hit a baseball a long way," Gardenhire said. "The problem comes when he tries to hit home runs. That screws him up, and he starts chasing. When he stays in the strike zone, he's a good hitter."
Houston missed a chance to add to its lead in the seventh.
Louis Coleman hit the first two batters, and a passed ball moved the runners to second and third with one out. Gardenhire intentionally walked Correa, loading the bases, and brought in lefty Daniel Stumpf.
Stumpf got Josh Reddick to pop out and was immediately replaced by right-handed Victor Alcantara. Tyler White hit a hard grounder to third and was originally ruled safe after Jeimer Candelario didn't field the ball cleanly. However, a replay review showed the throw beat White to first, ending the inning.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports
The secret that Vladimir Guerrero Jr. shared with ESPN
Vladimir Guerrero Sr. gave only one piece of advice to his son: follow in the footsteps of one of his teammates, considered a member of the family, and whom he has known since he was six years old - veteran designated hitter Kendrys Morales.
Stanton glad to play meaningful games 'past May 7th'
Giancarlo Stanton says the biggest difference about coming to New York is playing meaningful games in May and that postseason success is what is driving him.
Blue Jays' Vladimir Guerrero Jr. targets Kendrys Morales as mentor
Vladimir Guerrero Jr. says his Hall of Fame father advised him to seek out DH Kendrys Morales as a mentor in the same fashion Morales did with Guerrero Jr. as a rookie with the Angels nearly 15 years ago.
Miguel Cabrera faces pitcher for 1st time since June arm injury
Miguel Cabrera says he is fully healthy and ready to get back on the field and play. The two-time AL MVP hit against a pitcher Monday for the first time since rupturing a tendon in his left biceps on June 12.
Red Sox owner John Henry says spending more tends to helps teams win
Boston Red Sox owner John Henry said Monday that, while there is not a perfect correlation between a bigger payroll and winning, "spending more money helps."
Bochy: 'It's been an unbelievable ride'
Giants manager Bruce Bochy announces his upcoming retirement and explains how much he has cherished his time in San Francisco.