SAN FRANCISCO -- Matt Cain didn't think his 100th career victory would mean much to him until he finally got it.
"That hit me after the game was over," Cain said." I didn't think it was going to be that big of a deal but for it to take three years it feels good, it definitely feels good.
"Especially with the way it worked out today, we got to use everybody to be a part of it. It was definitely a win that we all needed very much."
Pitcher Madison Bumgarner pinch hit for Cain leading off the bottom of the fifth and hit an opposite-field double off the wall in right. Right-hander Jeff Samardzija, who ran for Bumgarner, scored the winning run.
Cain became the sixth Giants pitcher to reach 100 wins since the franchise came to San Francisco in 1958. Juan Marichal (238), Gaylord Perry (134), Tim Lincecum (108), Kirk Rueter (105) and Mike McCormick (104) are the others.
He can't remember another time he left with a no-hitter on the line.
"My pitch count was already high in the fifth inning and I was laboring through most of the innings putting guys on and working out of jams," Cain said. "The biggest thing was for us to find a way to win today and the bullpen did a great job, to be able to shut the door and get things done."
Santiago Casilla pitched the ninth for his 24th save. Casilla was among five Giants relievers who combined to allow one run on three hits over four innings.
NL West-leading San Francisco has won two straight since losing 11 of 13 following the All-Star break.
Nationals starter Gio Gonzalez (6-9) allowed two runs (one earned), six hits and two walks in six innings for his fourth quality start in five outings.
"He's throwing strikes, not walking people and getting out of jams when he gets in them," Nationals manager Dusty Baker said.
The Giants won despite troubles hitting with runners in scoring position that have dogged them throughout the second half.
They were 1 for 15 with runners in scoring position Sunday and are batting .139 (19 for 137) in that department since the All-Star break.
They were hitless in their first 11 at-bats with runners in scoring position Sunday until Angel Pagan singled in Denard Span from third with one out in the bottom of the seventh to give San Francisco a 3-1 lead.
The Giants scored their first two runs on Pagan's fielder's choice grounder in the third and third baseman Anthony Rendon's throwing error in the fifth.
Left fielder Mac Williamson left with an injury in the sixth. He dropped Chris Heisey's flyball on the play but fired to third baseman Conor Gillaspie to force out Rendon. Williamson is day to day with a jammed shoulder, Giants manager Bruce Bochy said.
RESPECTING THE GAME
After getting hit in the arm by a 94-mph fastball from Casilla leading off the ninth, Nationals first baseman Ryan Zimmerman didn't take kindly to the resounding boos he got from Giants fans implying that he was trying to sell home plate umpire Jim Joyce on the call. Bochy challenged the call, but it was upheld.
"I was fired up when I got hit. That's not something I normally do," Zimmerman said. "The one thing I never do is fake something like that. I have too much respect for the game."
Nationals: 2B Daniel Murphy was out of the lineup for a second straight day. He missed Saturday's game with left leg tightness.
Giants: CF Span and SS Brandon Crawford were both out of the lineup for a second straight day on Sunday. Span suffered a quadriceps injury beating out an infield hit on Friday. Crawford suffered a bruised thumb on a swing in the same game. Both entered late in the game and are expected to be back in the lineup Tuesday after an off day. ... Rehabbing 3B Matt Duffy (out since June 21 with a left Achilles tendon strain) was scheduled to play seven innings for Triple-A Sacramento on Sunday. He played five innings on Friday.
Giants: San Francisco plays at Philadelphia on Tuesday, and LHP Bumgarner (10-6, 2.09) will pitch. He ranks second in the NL in ERA, but the Giants have lost his last three starts and are 2-6 in his last eight. They haven't lost four straight Bumgarner starts since 2013 (Aug. 7 -- Sept. 3).
Chicago to visit Washington Saturday
Chicago Cubs (50-55, fourth in the NL Central) vs. Washington Nationals (48-55, fourth in the NL East)
New York to visit Miami Saturday
New York Yankees (54-48, third in the AL East) vs. Miami Marlins (44-59, fifth in the NL East)
Brubaker expected to start for the Pirates against the Phillies
Philadelphia Phillies (51-52, second in the NL East) vs. Pittsburgh Pirates (39-64, fifth in the NL Central)
Wood scheduled to start for San Francisco against Houston
Houston Astros (64-40, first in the AL West) vs. San Francisco Giants (64-39, first in the NL West)
Means scheduled to start for Baltimore against Detroit
Baltimore Orioles (36-66, fifth in the AL East) vs. Detroit Tigers (50-56, third in the AL Central)
Hearn expected to start for the Rangers against the Mariners
Seattle Mariners (56-48, third in the AL West) vs. Texas Rangers (36-67, fifth in the AL West)