Two months ago, an early two-run deficit would have had the Pittsburgh Pirates scrambling.

Now, it's just a blip. And for the moment, so is nearly two decades of losing.

Mike McKenry and Pedro Alvarez drove in two runs apiece and the Pirates looked pretty comfortable during their first day in first place, beating the Houston Astros 6-4 on Wednesday.

Pittsburgh has won seven of eight to improve to 45-36 at the season's midway point, looking very much like a team that could stick around through the summer.

"This stretch that we've had is awesome but I think this is very indicative of this ballclub," second baseman Neil Walker said. "We knew the bats were going to start coming around, and when we did we knew we were going to score a lot of runs."

Kevin Correia (5-6) will happily take the help. The 31-year-old pitched well early in the season but struggled to win as the offense limped out of the gate. Correia wasn't terribly sharp at muggy PNC Park but overcame a shaky start to give up three runs on six hits in six innings, walking two and striking out one to win at home against a National League team for the first time since joining the Pirates before the 2011 season.

The Astros touched Correia for two runs in the second, but the hole lasted all of 15 minutes before Pittsburgh — which rallied from a four-run deficit to win on Tuesday — roared back to take the lead.

"Normally the first month of the season, you give two runs early and you know it's going to be tight," Correia said. "Now just have complete confidence that that's not a lead that's going to hold against us now."

Joel Hanrahan pitched the ninth for his 21st save. Garrett Jones added two hits for Pittsburgh, which has its best record through 81 games since Barry Bonds was swinging for the fences at Three Rivers Stadium 20 years ago.

"You get here for a reason, it just doesn't happen," Hurdle said. "No one hits you with a wand and you end up in this spot. It hasn't been all hi-fives and walk-offs and giggles. There was some gnashing of teeth."

Not on Independence Day.

The Astros limped to their seventh straight loss, and major changes are in the offing. Slugger Carlos Lee was removed from the game in the seventh inning and his locker was cleared out afterward. Manager Brad Mills called it a "non baseball-related" decision then added "I don't want to go any farther than that."

Lee isn't the only Astros player apparently on the move. Though he has been one of the few bright spots of late, starter Dallas Keuchel (1-1) will be shipped to Triple-A Oklahoma City so the team can bring up a reliever to help out a weary bullpen.

Mills stressed the decision has nothing to do with performance. Keuchel gave up four runs in 5 2-3 innings, or one more run than he surrendered in his previous three starts combined.

"I knew if I got the first three guys out consistently I would have a good shot and I made some bad pitches to the bottom of the order and they made me pay," Keuchel said after his ERA rose from 1.35 to 2.45.

J.D. Martinez hit his 10th homer for Houston, while Scott Moore and Brian Bogusevic each had two hits, though it couldn't stop Houston from continuing its slide. The Astros are just 10-26 since moving within a game of .500 on May 25.

Mills, clearly frustrated, removed center fielder Jordan Schafer from the game in the second inning after a pair of fundamental mistakes. His off-line throw allowed the plodding Jones to turn a single into a double. Schafer later threw to the wrong base on sacrifice fly by McKenry, allowing two runners to move up and help the Pirates turn a 2-0 deficit into a 3-2 lead.

"I just felt that (Schafer's) play and behavior didn't match what we needed to get done," Mills said.

Pittsburgh pushed it to 4-2 on McKenry's RBI-double in the fourth and the Pirates — who won on Drew Sutton's walk-off homer in the bottom of the ninth on Tuesday — made sure no such heroics were required.

Andrew McCutchen went 1 for 3 to keep his NL-leading batting average at .360 while Alvarez continued to show signs that he's developing into the elite slugger the franchise envisioned when it selected him with the fourth pick in the 2008 draft. Alvarez had a two-run pinch-hit single during the comeback victory on Tuesday and his two-run single in the seventh gave the Pirates a cushion after the Astros pulled within 4-3.

"You're seeing a guy finding his rhythm and his confidence," Hurdle said of Alvarez. "To do that on a breaking ball from a left-hander, it was a very pretty swing."

NOTES: The series concludes on Thursday as Pittsburgh's Jeff Karstens (1-2, 5.25 ERA) faces Houston's Bud Norris (5-5, 4.90) ... The Astros haven't won on July 4 since beating the Cubs in 2006 ... Pittsburgh reliever Jason Grilli tossed a scoreless eighth inning while making his 300th major league appearance.