Luis Valbuena homered earlier in the contest, while Jose Altuve and George Springer also drove in runs during the pivotal seventh frame.

"We're a resilient team," Springer said. "It's a good sign of things to come."

Will Harris (2-0) earned the win in relief of starter Brett Oberholtzer, who allowed two runs on seven hits over 5 1/3 innings.

Baltimore, which took two out of three last week at home against the Astros, has dropped three straight games.

Houston trailed by one entering the home seventh when it scored four in the frame to take a 5-2 lead.

The Astros loaded the bases with singles by Chris Carter and pinch-hitter Hank Conger around a walk to Valbuena. Brad Brach (3-1), who relieved starter Ubaldo Jimenez after Carter's leadoff single, struck out Marwin Gonzalez before a single by Springer and a sacrifice fly by Altuve made it 3-2.

Gattis knocked a two-run single later in the inning, but Preston Tucker was thrown out at third to end the inning.

"I didn't have it tonight," said Brach. "It was just one of those nights."

Luke Gregerson pitched the ninth for his 14th save of the season.

Each team plated a run in the fifth. Oberholtzer walked Steve Pearce to begin the frame, then Ryan Flaherty drilled a triple out to right two batters later for a 1-0 lead.

Valbuena's solo shot to right in the home half of the inning tied the game.

Baltimore regained the lead in the sixth on Chris Davis' RBI double. Adam Jones, who returned to the lineup after missing a couple of games over the weekend due to a sprained left ankle, walked with one out before Delmon Young singled to right. Davis followed with a double out to right that plated Jones for a 2-1 edge.

Game Notes

Houston catcher Jason Castro left the game with a knee injury ... Harris lowered his ERA this season to 0.35 ... Oberholtzer entered the game with a 2-0 record and 0.64 ERA in two career starts against Baltimore ... Jimenez struck out eight and was charged with two runs in six-plus innings.