HOUSTON — Brandon Moss was having a frustrating night before the ninth inning.
Mired in an 0-for-14 rut, Moss turned things around on one pitch.
Josh Reddick homered for the AL West-leading A's and Yoenis Cespedes had three hits, including two doubles.
"It had not been a very good day until that last at-bat," Moss said. "I was just trying to battle, stay on the ball a little bit. Get on base any way I could. If I got a good pitch to hit, hit it hard."
Oakland trailed 4-1 in the ninth before pinch-hitter Alberto Callaspo had a two-run single off closer Chad Qualls (1-2).
After Houston couldn't turn a potential game-ending double play on John Jaso's grounder, Jed Lowrie walked and Cespedes tied it with a single.
Moss ended his slump with the RBI single off Tony Sipp and then Josh Donaldson hit a two-run double off Jose Veras.
"We always have confidence in him," Oakland manager Bob Melvin said of Moss. "He's played himself into a role here this year where he's getting at-bats against left-handers, too, and doing some damage, and no more than that one right there."
Evan Scribner (1-0) got the win and Sean Doolittle pitched the ninth for his 16th save.
"They just found some holes when they needed to and hit the ball on the screws when they needed to," Qualls said. "I just didn't get it done."
Marwin Gonzalez homered off the left-field foul pole in the first inning to give the Astros a 1-0 lead. Enrique Hernandez had an RBI triple as part of a two-run fifth and an RBI double in seventh to give the Astros the 4-1 lead.
"Any time you lose games in the eighth or ninth inning, those are tough games to lose," Houston manager Bo Porter said. "We were in position to win the ballgame and just were not able to close it out."
Astros starter Scott Feldman allowed one run and five hits in seven innings. He rebounded after one of his worst outings of the season Thursday at Oakland in which he gave up six runs in 5 1-3 innings.
A's starter Jeff Samardzija gave up four runs and six hits with seven strikeouts in 6 2-3 innings.
"I'm not happy with how I pitched, but to keep it close and give these guys a chance, sometimes that's all I need," Samardzija said.
Athletics: Outfielder Coco Crisp, who has missed the last two games with a neck strain, had an MRI on his neck Monday. The exam showed no changes, A's manager Bob Melvin said.
Astros: Outfielder George Springer, who has been on the disabled list since July 20 with a right quad strain, took batting practice Tuesday. "It's big to be out here and just to get some swings," Springer said.
Right-hander Jason Hammel will try to get his first win with the A's after going 0-3 with a 7.11 ERA in his first three starts since being acquired July 5 from the Cubs. Houston lefty Dallas Keuchel, who is 9-7 with a 3.11 ERA, will try to follow up a solid outing in a 2-0 loss to Miami in the final game of the three-game series Wednesday.
OAKLAND NEVER OUT OF IT
The win Tuesday was the A's sixth this season when trailing after eight innings and was the second time the A's scored at least six runs in the ninth this year after Oakland scored seven runs in the top of the ninth on April 25, also at Houston.
A STREAK CONTINUED AND SNAPPED
Houston second baseman Jose Altuve extended his hitting streak to 11 games with his RBI single in the fifth. The streak is Altuve's second-longest of the season after a 12-game streak from May 8-21. Astros outfielder Robbie Grossman was 0 for his last 13 before a single in the fifth.