The Rangers stayed in the wild card playoff chase by winning their third in a row.
Texas trails Cleveland by one game in the chase for the second wild card position and is two games behind Tampa Bay for the No. 1 spot.
The three teams battling for the two wild card berths all have four games remaining in the regular season. Tampa Bay will be at the New York Yankees on Thursday for a makeup game before traveling to Toronto for three, Cleveland will visit Minnesota in a four-game series and Texas will be at home against the Los Angeles Angels for four.
Houston lost its 12th in a row and suffered its 108th setback of the season.
The Astros took a 3-1 lead in the top of the fourth with Brandon Laird contributing a two-run homer, but Texas quickly responded with a two-out rally in the bottom half of the inning.
Jeff Baker singled to start the comeback, Mitch Moreland walked and Craig Gentry was hit by a pitch to load the bases. Martin then doubled to right to put Texas in front.
The win went to Martin Perez (10-5), who allowed three runs on six hits in seven innings. Texas roughed up Dallas Keuchel (6-10) for six runs on six hits in 5 2/3.
Celebrity Couples of 2014 [PHOTOS]