HOUSTON - Evan Gattis hit a three-run homer to put Houston ahead in the seventh inning, and the Astros rallied past the Oakland Athletics 10-6 Saturday night to snap a five-game losing streak.

Houston leads the race for the second AL wild card by 1 1/2 games over the Los Angeles Angels, who swept a doubleheader at Minnesota. The Astros remained 2 1/2 games behind first-place Texas in the AL West.

With the Astros trailing by a run in the seventh, Gattis hammered a pitch from reliever Fernando Rodriguez (4-2) to right field, giving Houston the lead for good and sending the crowd into a frenzy.

Mark Stassi added a solo shot and Jake Marisnick scored on a sacrifice fly in the eighth for Houston.

Jake Smolinski and Marcus Semien each hit a solo homer for the A's. Smolinski finished with two RBIs and two runs.

For the second consecutive night, the Astros managed to blow a 3-0 lead. With the game tied 3-all and two outs in the fifth, Smolinski doubled off reliever Vince Velasquez to score Semien. Carson Blair hit an RBI single and scored on Craig Gentry's triple to give the A's a 6-3 lead.

Houston began a comeback of its own in the sixth with Luis Valbuena's RBI single off Sonny Gray, and Matt Duffy's pinch-hit RBI double off reliever Drew Pomeranz.

Scott Kazmir laboured through 3 2-3 innings for his shortest outing in 11 starts for the Astros. He gave up three runs and five hits, including the two homers.

Kazmir was pulled after allowing Mark Canha's tying single with two outs in the fourth.

Chad Qualls (3-4) pitched a scoreless seventh for the win. Astros closer Luke Gregerson, who left the team Wednesday for the birth of his son, returned to pitch a scoreless ninth.

The Astros jumped out to a 3-0 lead in the first with the help of several Oakland miscues. They included a poor route to a fly ball by Smolinski, two wild pitches and three walks by Gray, and an errant throw to third by Blair.

It could have been worse for the A's, but Gattis was thrown out at second trying to advance on a fly ball.

Gray recovered to last 5 1-3 innings, until Valbuena's single scored Colby Rasmus.

TRAINER'S ROOM

Athletics: OF Billy Burns made his first start since Sept. 9. A tight right hamstring kept him out of the lineup the previous eight games, although he pinch-hit in Friday's 4-3 win.

Astros: OF Carlos Gomez missed his seventh straight game with discomfort in his ribs. He is day to day.

UP NEXT

Astros RHP Collin McHugh (16-7, 4.05 ERA), who is 3-1 in his career against the A's, aims for his third win this month. He will be opposed by Oakland RHP Aaron Brooks (2-3, 7.68), who is 1-3 with a 12.60 ERA in his last six appearances, including five starts.