PITTSBURGH -- When Andrew McCutchen stepped to the plate in the eighth inning, he wasn't looking for a home run but he thought he had one to complete a cycle.
No such luck for the Pittsburgh Pirates star. McCutchen had to settle for his second double and RBI.
McCutchen nearly finished the feat when he drove a pitch from B.J. Rosenberg to the opposite field.
"That should've been a homer," McCutchen said of his double. "I thought I was going to get it but I didn't."
Mercer had two of Pittsburgh's 13 hits, and each of the Pirates' eight position players who started the game had at least one.
Pittsburgh jumped on starter Roberto Hernandez in the first inning and scored four runs on five hits and sent nine men to the plate.
"Everything went wrong," Hernandez said. "I couldn't get the ball down, and everything I threw was flat."
All the runs scored with two outs against Hernandez, who threw 45 pitches in the first.
"We were just trying to see him up," McCutchen said. "See something out over the plate, and we got the pitches."
Gerrit Cole (7-4) made his second start since coming off the disabled list after he had right shoulder fatigue. He showed signs of progress after he allowed the New York Mets to score five runs in four innings on Saturday.
Cole threw just 80 pitches in five shutout innings and gave up only one hit. He walked one and struck out five.
"Today, I just felt more like myself." Cole said.
While Cole took a step forward on the mound, Pirates manager Clint Hurdle also saw a sign of maturity from his young starter. After five innings, Cole told Hurdle he felt soreness in his right lat. That ended his fine start.
"We'll probably know a little bit more (Saturday)," Hurdle said. "I don't think anybody is overly alarmed right now."
Hernandez (3-8) settled down after the rough first and pitched 5 2/3 innings. He gave up five runs, 10 hits and four walks, and struck out three.
"Fortunately, he was able to pitch six innings," Phillies manager Ryne Sandberg said. "It could have been a lot worse."
Hernandez was pulled after he walked Starling Marte with two outs.
Marte got the Pirates' first-inning surge going with a one-out single, but he was thrown out at the plate by shortstop Jimmy Rollins, who fielded a hit by McCutchen in shallow left that bounced off the glove of third baseman Cody Asche.
Hurdle stressed a patient approach heading into the matchup with Hernandez, and that paid immediate dividends for his hitters.
"Even with trying to be aggressive and score a run early we kept going," Hurdle said. "We got some big hits down the road."
They added a run in the fourth when Gregory Polanco singled and scored on McCutchen's double to left.
Philadelphia got on the board in the sixth against reliever Stolmy Pimentel, who walked three of the four hitters he faced and didn't record an out.
The Pirates answered Philadelphia's two runs with two in the seventh when Mercer doubled in Martin and Sanchez.
McCutchen drove in his second run in the eighth with his second double, scoring Polanco from first after he led off with a walk.
Philadelphia has lost only twice on Independence Day in 11 years, both times at PNC Park. The Phillies' previous July 4 defeat was 8-5 in 2009. ... The attendance of 38,977 was a Pirates record for a July 4 game. ... Pittsburgh RHP Edinson Volquez (6-6, 4.07 ERA) matches up with Philadelphia RHP David Buchanan (4-4, 4.86 ERA) on Saturday in the second game of the three-game series.