PITTSBURGH, Pa. - Andrew McCutchen went 4 for 5 and finished a home run short of a cycle, and Jordy Mercer drove in a career-high four runs to lead the Pittsburgh Pirates to an 8-2 rout of the Philadelphia Phillies on Friday.

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. All the runs scored with two outs against Hernandez, who threw 45 pitches in his inning.

Gerrit Cole (7-4) made his second start since coming off the disabled list after he had right shoulder fatigue.

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.

Hernandez was pulled in the sixth 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.

After Neil Walker walked, Russell Martin and Josh Harrison connected for RBI singles. Mercer drove in two runs with a single after Gaby Sanchez walked, giving the Pirates a 4-0 lead.

They added a run in the fourth when Gregory Polanco singled and scored on McCutchen's double to left.

Cole threw just 80 pitches in five shutout innings and allowed only one hit innings. He walked one and struck out five before being removed from the game because of right lat soreness.

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.

After Pimentel walked Ben Revere and Rollins, Chase Utley singled down the right field line to make it 5-1.

Jared Hughes replaced Pimentel after a walk to Ryan Howard. Marlon Byrd hit into a double play that scored Rollins, before Hughes struck out Asche looking.

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.

Justin Wilson, Tony Watson and Jeanmar Gomez each worked a perfect inning to finish off Pittsburgh's win.

NOTES: 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.