Updated

Cole Hamels tossed eight scoreless innings and the Philadelphia Phillies avoided getting swept by the Washington Nationals with a 4-1 win in the finale of a three-game set.

The last time Hamels (7-1) faced Washington, he plunked Bryce Harper in the back, later stating that he intended to hit the rookie. That led to a five- game suspension for Hamels, but he didn't let it faze him on Wednesday.

He carried a no-hitter into the sixth inning and remained undefeated since dropping his first start of the season back on April 9. He is now 7-0 over his past nine starts and gave up just four hits with three walks and eight strikeouts in Wednesday's game.

"He mixes pitches real good and he did it tonight," said Philadelphia manager Charlie Manuel. "He had his fastball down and threw his changeup when he needed it."

Shane Victorino hit a solo home run and drove in two, Carlos Ruiz went 3-for-4 with a run scored and Mike Fontenot added two hits, an RBI and a run scored for the Phillies, who snapped a four-game losing streak.

Adam LaRoche hit a solo home run in the ninth to account for the only run for the Nationals, who had won three straight coming in. Edwin Jackson (1-2) gave up three runs on seven hits with two walks and four strikeouts over seven innings.

"I was just trying to keep us within striking distance," Jackson said.

Hamels walked the leadoff batter in three of the first four innings, but didn't allow a hit until Danny Espinosa punched a double to left with one out in the sixth.

Harper followed with a single to right, but Hunter Pence came up throwing and one-hopped the ball to the plate where Ruiz applied the tag on Espinosa. Ryan Zimmerman followed with a single, but Hamels got LaRoche to ground out.

The Phils backed up Hamels' effort with runs in the second and third innings.

Ruiz led off the second with a single, but the next two batters recorded outs. Freddy Galvis then singled to keep the inning alive and Fontenot punched a bloop single to right to plate Ruiz.

Pence walked with two outs in the third and Ruiz followed with a single. Victorino then doubled home Pence for a 2-0 advantage.

After the Nationals went down in order in the seventh, the Phils plated another run in the bottom of the inning. Fontenot led off with a double and moved to third on Hamels' sac bunt. Juan Pierre then laid down a bunt back to the mound with Fontenot breaking for the plate to execute the suicide squeeze for a 3-0 lead.

"We had the right runner and we had the right bunter at that point," said Manuel.

Jesus Flores led off the eighth with a triple, but wound up stranded there. Steve Lombardozzi lofted a fly ball to shallow left that Galvis made a great over-the-shoulder catch on. Espinosa and Harper each grounded out to keep the shutout going.

Victorino hit a two-out, full count pitch deep over the right field wall in the eighth for a 4-0 lead.

LaRoche's eighth home run of the season in the ninth off of Jonathan Papelbon broke up the shutout.

Game Notes

Jackson had not factored in a decision over his previous five starts...Hamels improved to 12-4 in 22 career starts against the Nationals...The Nationals have won nine of the last 11 games against the Phillies, including four of six this season...The Phillies begin a four-game set in St. Louis on Thursday...Washington has off on Thursday before traveling to Atlanta to start a three-game set on Friday.