"It feels good to be able to go and stop the skid of the last couple of days," Hamels said. "We played outstanding defense and a couple of the plays made really saved us."
This was Hamels first appearance against Washington since the 9-3 win on May 6, when he plunked rookie Bryce Harper with the first pitch he saw and then later admitted it was done on purpose. In his first at-bat that game, Hamels was hit by Jordan Zimmerman.
Both managers said pre-game that the incident was over and Hamels felt the same way. There were no incidents in Wednesday's win.
"It wasn't even in my head," Hamels said.
The Phillies are now 2-4 against the Nationals this year and Hamels owns both wins.
"It wasn't that we beat the Nationals - we needed to win a game," manager Charlie Manuel said.
The Phillies (22-23) now depart for a seven-game road trip beginning with Thursday's game in St. Louis.
In addition to Hamels' performance, catcher Carlos Ruiz - batting cleanup for the first time in his career - went 3 for 4 with a run scored.
Edwin Jackson, who allowed three runs over seven innings, took the loss for Washington (26-18).
Danny Espinosa got the Nationals' first hit with a one-out double in the sixth inning.
Bryce Harper then drilled a single to right and Espinosa made an ill-fated gamble by attempting to score.
Hunter Pence charged the ball and threw a laser that nailed Espinosa at the plate. Ruiz did an excellent job blocking the plate while making the tag.
The Phillies needed three singles to score their first run in the second inning. Ruiz led the inning off with a base hit and advanced to second on Freddy Galvis' two-out single before scoring on Mike Fontenot's single to right.
Fontenot's RBI single came on Harper's missed attempt at a diving catch, although the right fielder didn't allow the ball to get by him.
In the third inning, Pence drew a two-out walk, advanced to second on Ruiz's single and scored on Shane Victorino's double.
The Phillies made it 3-0 in the seventh when Fontenot led off with a double to right. Hamels sacrificed him to third and then Juan Pierre executed a successful suicide squeeze bunt.
Washington's Jesus Flores led off the eighth with a triple. Galvis then made a sensational running, over-the-shoulder catch in short left field on pinch-hitter Stephen Lombardozzi for the first out.
Galvis was again at shortstop for Jimmy Rollins, still out on paternity leave. It was Galvis's second top defensive play. In the second inning, Galvis fielded a ball almost behind second base and, in one motion, threw out Ian Desmond.
With one out in the eighth, the Phillies got a momentary scare when a foul ball by Espinosa hit Ruiz in the right wrist. After a brief delay, Ruiz returned behind the plate.
Espinosa grounded to third for the second out and Flores was unable to advance. Hamels then got out of the inning when Harper grounded to Galvis.
The Phillies' fourth run came on Victorino's solo home run to right in the eighth.
Contact Marc Narducci at 856-779-3225, firstname.lastname@example.org or follow @sjnard on Twitter.