Clayton Richard pitched one of his best games of the season Wednesday night. Unfortunately for the Padres, Lucas Harrell was even better.

Harrell pitched a six-hitter for his first complete game and left fielder J.D. Martinez threw out a runner at the plate in the ninth inning to preserve the Houston Astros' 1-0 victory over San Diego.

Matt Downs homered and Harrell (7-6) finished it off by striking out Nick Hundley with the bases loaded.

Richard (5-8) allowed only two hits in seven innings, but one of them proved to be the difference in the game. Downs' home run in the third gave the Astros their only run against Richard, who allowed just one other runner on a single by Martinez.

"Baseball is a funny game," Richard said. "Sometimes you pitch well and don't get the results you want. But that just goes to show how much of a team game this is. You have to have everything going to get wins."

The Padres managed six hits but could never turn them into anything that would help Richard. He acknowledged being disappointed when San Diego manager Bud Black elected to pinch-hit for him in the eighth.

"As a pitcher, you always want to stay in as long as you can," Richard said. "That's what you pride yourself in. In that situation, in a one-run game, Buddy is going to make a decision that he feels will best help us win the ballgame."

Black defended his decision by saying the Padres had just three at-bats left to crack Harrell, who struck out seven and walked four.

"The game dictates what you do with your starting pitcher, and that was just a classic National League game where you have to pinch-hit him to try to win the game," Black said.

The game took just 1 hour, 57 minutes — the fastest of the season for San Diego.

The Padres had everything in line to steal the game from Harrell and Houston in the ninth.

Chase Headley led off with a single, but Carlos Quentin grounded into a fielder's choice and Headley was thrown out at second. Alexi Amarista ran for Quentin and advanced to second when Yonder Alonso walked.

The next batter, Logan Forsythe, singled to left and Martinez threw out Amarista at the plate.

"I knew the guy was fast," Martinez said. "I was just lucky that my outfield coach put me in good position, brought me in a little bit and gave me a much better chance to get to the ball quicker and make a much better throw on it."

Pinch-hitter Mark Kotsay followed with a walk to load the bases. On a 2-2 count, Harrell struck out Hundley to end the game.

"It was another night of pressing them as best we could without scoring," Black said. "They executed a play in the ninth and beat us. We didn't lose that game. The Astros beat us."

Alonso, who returned to the starting lineup after missing the last three games with a sore knee, singled with one out in the second. But Houston turned a double play before Harrell pitched a perfect third to face the minimum through three innings.

Everth Cabrera walked in the fourth and stole his 12th base in 12 tries this season, but he was left on base when Alonso was retired to end the inning.

The Padres stranded eight runners in all.

The loss marked the second time this month and the seventh time this season that the Padres were shut out. The last time was June 3 against Arizona's Trevor Cahill.

San Diego has scored one run or less four times in Richard's 16 starts this season. The Padres dropped to 11-11 in one-run games.

"It always stings when you lose, and when they're closer, they sting a little bit more," Richard said. "It's unfortunate, but we'll move on and try to get them tomorrow."

NOTES: Houston 2B Jose Altuve was out of the lineup for the third straight game with a strained right hamstring. ... The teams wrap up their four-game series Thursday when San Diego's Andrew Cashner faces left-hander Dallas Keuchel.