HOUSTON -- Even in the midst of the worst season of his career, Carlos Lee has a knack for hitting key home runs.
"I took advantage of the opportunity," he said. "That doesn't happen very often so you have to take advantage of it when it happens."
Lee is batting just .249 on the year but four of his 15 homers have given Houston the lead in its final at-bat.
"I know people get on him about his year, but that's pretty nice," manager Brad Mills said of the clutch drives. "It was great to see Carlos come through there."
Houston was down before Lee connected against All-Star reliever Evan Meek (4-4), belting a drive to the Crawford Boxes in left. Angel Sanchez reached on a one-out single and Hunter Pence walked before Lee's shot.
"[Meek] is not an easy guy to hit," Lee said. "It was one of those games where one hit changes it all and it wasn't my hit, it was Sanchez. ... I mean the momentum got going and we scored four runs. That was great today."
The Astros kept going after Lee's go-ahead drive, putting together three consecutive singles. Rookie Brett Wallace's hit scored Geoff Blum to make it 4-1.
Meek said he had trouble keeping the ball down.
"The guys really fought and to go out there and pitch how I pitched tonight is really tough," he said. "That's just something that weighs on your shoulders when you go up there and struggle. I'm just kind of in a rut. I'm falling behind hitters, walking guys. When you do that, it's not going to be pretty."
The Pirates wasted a great start by Ross Ohlendorf in their fifth consecutive loss and eighth straight on the road, dropping to a major league-worst 39-76.
"This is what Ross looks like when he's winning," Pirates manager John Russell said. "His pitches were working well. His velocity was very good. It was a great game. He really did a nice job. Hopefully we can get him a win someday."
Wilton Lopez (4-0) allowed one hit in a scoreless eighth inning and Brandon Lyon finished for his third save.
Pittsburgh went ahead in the third inning against Brett Myers. Andrew McCutchen singled, stole second and moved to third on Jose Tabata's grounder. Neil Walker then drove him with a single to center.
Myers pitched seven innings and has lasted at least six innings in each of his 24 starts, extending his franchise record to start a season. He allowed seven hits, struck out seven and walked none.
Ohlendorf was even better, pitching 6 2/3 innings of four-hit ball. But he remains winless in 10 appearances against the Astros.
Ohlendorf allowed a pair of singles with one out in the first inning before walking Lee to load the bases. He pitched out of that jam by striking out Blum before Chris Johnson popped out to end the inning.
He retired 11 of the next 12 batters before walking Michael Bourn with two outs in the fifth. Bourn stole second but was stranded when Ohlendorf struck out Sanchez.
Pedro Alvarez had three hits, a pair of singles and a ground-rule double, for the Pirates. Ohlendorf struck out seven and walked two.
Pittsburgh SS Ronny Cedeno was sidelined with inflammation in his left shoulder. He doesn't think it's serious and expects to return soon. ... Tests performed on Houston closer Matt Lindstrom's bothersome back showed no structural damage. He was given medication and hopes that combined with treatment will eliminate the problem. ... Houston RHP Felipe Paulino was examined by Dr. James Andrews for a second opinion on his injured right shoulder. Andrews agreed with the first diagnosis of a rotator cuff strain and recommended continued rest and treatment. Paulino has been on the disabled list since June 21.