Hernandez (7-11) outpitched All-Star Cole Hamels (13-7) to rebound from a rough outing at Colorado last Saturday. He gave up one unearned run and four hits.
The streaking Phillies were coming off a franchise-best 9-1 road trip. The four-time NL East champions have a healthy lead in the division and lead the majors with a 77-41 record.
Hamels lasted just five innings, his third-shortest outing this season. He allowed three runs, six hits and tied his season-high with four walks. Hamels gave up two runs or less in 14 of his previous 15 starts.
Hernandez baffled the Phillies with his assortment of offspeed pitches. He twice fanned Hunter Pence on curveballs in the 60s. In three at-bats against the veteran righty, Pence swung and missed at five pitches between 66-69 mph.
Tyler Clippard retired the four batters he faced, and Drew Storen finished for his 31st save in 35 tries. Storen allowed a run on a sacrifice fly by Pence.
Hamels worked out of a jam in the first, but couldn't do it again in the second. Wilson Ramos led off with a single and Laynce Nix walked. After Ian Desmond struck out, Hernandez singled off shortstop Jimmy Rollins' glove to score Ramos. Rick Ankiel followed with an RBI single to make it 2-0.
The Phillies cut it to 2-1 in the bottom half on an RBI single by Wilson Valdez. Ryan Howard reached on second baseman Danny Espinosa's fielding error to start the inning and scored on Valdez's liner to center.
An RBI groundout by Jayson Werth in the fifth put the Nationals up 3-1. Washington had the bases loaded with no outs and a 3-0 count on Jonny Gomes, but only scored one. Gomes flied out to shallow right before Werth hit a slow roller to first base to drive in Ankiel.
Hernandez singled in another run in the sixth off Kyle Kendrick. He fouled off a sacrifice bunt before grounding a single up the middle to score Desmond.
Hernandez, who has 10 career homers, is batting .231 with seven RBIs this season.
This was Werth's second trip to Philadelphia since signing a $126 million, seven-year contract with Washington. Werth heard a mixture of boos and cheers. A fan in right field held up a sign that read: "Not Werth a Pence."
The Nationals didn't have their best hitter in the lineup. Michael Morse sat out a day after getting hit in the left elbow with a pitch by Chicago's Ryan Dempster. Morse leads Washington in average (.319), homers (20) and RBIs (68). He hopes to return on Saturday.
Notes: Former Phillies All-Star 1B John Kruk was inducted into the team's Wall of Fame. Kruk, a baseball analyst on ESPN, took a shot at people who criticize Philadelphia fans. "I hear a lot of people say: 'It's tough to play in front of the fans in Philadelphia,"' Kruk said. "To those people, I say: 'You didn't have the guts to succeed here."' ... Washington's Ryan Zimmerman was 0 for 2 with two walks, snapping his 19-game hitting streak. ... Desmond was 1 for 26 before he hit a double in the sixth. ... A crowd of 45,762 was the 196th straight sellout at Citizens Bank Park, including postseason play. ... Phillies RHP Roy Oswalt (4-7, 3.84) makes his second start since returning from the DL on Saturday. Oswalt, who missed almost two months because of a back injury is 1-7 since a 3-0 start. He's 5-4 with a 3.12 ERA in 18 career games against Washington. ... Nationals LHP John Lannan (8-7, 3.56) faces the Phillies on Saturday. He's 1-10 with a 5.96 ERA in 14 starts vs. Philadelphia.