HOUSTON (AP) -- Not even a ninth-inning home run that ended his bid at a first career shutout could ruin Martin Perez's day.
Perez threw a four-hitter for his first career complete game, leading the Texas Rangers to their seventh straight victory, 6-1 over the Houston Astros on Sunday.
''When I go to the mound I think, 'I'm the best here, and I have the ball,''' Perez said. ''I just want to throw. That's what I did tonight. I took the ball and threw the pitch where (catcher Geovany Soto) called it.''
Perez (5-3) struck out a career-high eight while walking two in earning his second straight win. Perez has allowed four runs over his last 22 2-3 innings, spanning his last three starts.
''He threw a lot of strikes out there today,'' Texas manager Ron Washington said. ''He's good at keeping the ball down. He has good mechanics. I think when he gets erratic it's only because he tries to do too much. As long as he stays throwing the ball through the catcher and spots his fastball down in the zone the way he's capable of doing, he'll be fine.''
Perez retired 15 of 17 batters from the third to the eighth, including nine in a row before Jake Elmore's single with two outs in the eighth.
''His fastball command was there. His changeup was there,'' Soto said. ''He had a lot of early outs in the third, fourth, fifth innings.
''I think he looks a little bit different. He has more conviction, more aggressiveness, more attack. I feel like he's doing that. Whenever he needs a strike leading off the inning or leading off an at-bat, he got a strike. He uses all his pitches real well and he used all his pitches well today.''
The left-hander gave a lot of credit to Soto.
''He helped me out with pitches, and we have a good relationship,'' Perez said. ''He called the pitches. I just threw it 100 percent. He's a good catcher and called a good game.''
Chris Carter ruined Perez's shutout bid with a home run with two outs in the ninth inning, but Perez said the home run didn't matter because the most important thing was the Rangers won.
Alex Rios had two hits, drove in a run and scored twice in his second game with the Rangers, who have won 12 of their last 13 games. Adrian Beltre also had two hits.
Dallas Keuchel (5-7) allowed six runs and eight hits with eight strikeouts in 8 2-3 innings. He was the second Astros starter to go into the ninth this season, as Bud Norris threw eight-plus innings May 8 against the Los Angeles Angels.
''That was the best I felt all year,'' Keuchel said. ''(Perez) was better than me today, and I didn't make pitches when I needed to.''
Keuchel set down the first 13 batters before Rios beat out a grounder to short with one out in the fifth for the Rangers' first hit.
Soto then put the Rangers ahead 1-0 with a ground-rule double to center field.
Rios laced a two-out double down the right-field line in the sixth to extend the lead to 2-0. Elvis Andrus reached on an error with one out and advanced to second on Beltre's single before scoring on Rios' double.
Perez had his offense to thank for the opportunity to finish off the complete game, as he was told he would not be given a chance to finish it if the Rangers did not score at least two runs in the ninth. The offense plated four in the inning.
Texas upped the lead to 5-0 in the ninth on Jurickson Profar's based-loaded single with two outs, plating Rios and Jeff Baker. Craig Gentry came around to score on an errant thrown by L.J. Hoes, and Profar scored on Leonys Martin's single to make it 6-0.
Houston has lost five in a row and nine of the last 10 games. The Astros own the worst record in the majors at 37-79.
''I think we were overly aggressive,'' Houston manager Bo Porter said. ''It would have been a better idea to slow the game down and get the pace in your favor, but it felt like the more outs (Perez) recorded, the quicker our at-bats got.''
NOTES: Texas DH Lance Berkman went 2 for 3 with a home run and drove in two runs in his first rehab game Saturday night for the Rangers' Triple-A affiliate, Round Rock. Berkman has been on the disabled list since July 7 with left hip inflammation. . Texas RHP Neftali Feliz was expected to throw Saturday for Round Rock but did not pitch as a precaution because of mild right arm triceps tendinitis. He will throw on flat ground Sunday and be re-evaluated. Feliz has been rehabbing from Tommy John surgery last year. . Texas sent SS Leury Garcia to the White Sox on Sunday to complete the trade for Rios. . Houston SS Jonathan Villar, who had not started the previous three games because of a left thumb sprain, did not start Sunday's game, either. Porter said Villar was not in the lineup Sunday because the Rangers were starting a left-hander and the thumb bothers Villar more batting right, but Villar is expected to start Monday.