Astros slugger Carlos Lee stepped up to the plate for the fourth time Friday night at Minute Maid Park with only a walk to show for his previous efforts.

Brett Myers’ latest pitching performance — and the fact the team was awfully close to wasting it — resonated with Lee.

So Lee did something about it, hitting a three-run homer in the eighth inning to jump-start the Astros to a come-from-behind 4-1 victory over the Pittsburgh Pirates.

“It was a big hit, especially after Myers had thrown a really good game as he has been doing all year long for us,” Lee said. “I took advantage of the opportunity. That doesn’t happen very often (this season), so you have to enjoy it when it happens.”

Geoff Blum, who got a rare start at second base, and rookie Chris Johnson followed with back-to-back singles, and rookie first baseman Brett Wallace drove in an insurance run with a base hit as the Astros (49-65) improved to 7-0 at home against the Pirates (39-76), who are well on their way to an 18th consecutive losing season.

Myers extended his club record for consecutive starts of at least six innings to begin a season to 24 with a seven-inning outing.

“I struggled a little bit early on; I just couldn’t find a rhythm,” Myers said. “I went up and talked to (pitching coach Brad Arnsberg) a couple of times, just telling him I couldn’t get the guys to swing at certain pitches. He backed me up and gave me a solid plan to go out there and establish.

“It ended up working to get me through seven, because the way it was going I didn’t think I was going to make it through five, honestly.”

The win went to rookie Wilton Lopez (4-0), who pitched a scoreless eighth. Brandon Lyon, who is handling closer duties while Matt Lindstrom is sidelined by back problems, worked the ninth for his third save.

Duel until the eighth

Ohlendorf, meanwhile, allowed four hits and two walks while striking out seven in one of his best outings.

Yes, two of the worst teams in the National League were engaged in a pitchers’ duel.

Until the eighth.

“It was one of those games in which one hit changed it all,” Lee said. “And it wasn’t my hit; it was Sanchez’s. He got on base (with a single) and Pence walked. The momentum got going, and we scored four runs.”