San Francisco, CA – Ian Desmond's RBI single in the top of the 10th inning sent Washington past San Francisco, 2-1, in the finale of a three-game set.
Bryce Harper's sixth-inning homer was the only other offense for the Nationals, who avoided a sweep and put the brakes on a four-game skid.
"Glad to be going home and coming home with a win," said Washington manager Davey Johnson.
Tyler Clippard (3-1) tossed a scoreless ninth for the win and Rafael Soriano followed suit in the bottom of the 10th for his 13th save.
Buster Posey knocked in the lone run and Andres Torres doubled twice for the Giants, who have dropped four of their last six.
Jeremy Affeldt (1-1) was charged with the loss for giving up the deciding run.
Harper stroked a one-out double to kick off the final frame, and after an intentional walk to Ryan Zimmerman, Desmond's base hit to right brought in the go-ahead run. The Nats couldn't provide any insurance, as Adam LaRoche grounded out and Roger Bernadina fanned with two in scoring position.
"(Harper) played well defensively and got a couple big hits against us," Giants manager Bruce Bochy said.
Soriano retired the side in order to close out the contest.
Harper broke the scoreless deadlock with his leadoff homer in the sixth, an opposite-field shot which landed a couple rows deep in left.
Javier Lopez prevented Washington from extending its lead in the eighth, taking over for Jose Mijares with runners on the corners and two down, inducing an inning-ending pop to left from LaRoche.
The Giants responded in the home half. Angel Pagan walked with one out and Washington starter Gio Gonzalez exited for Drew Storen, who walked Marco Scutaro ahead of Posey's game-tying base hit.
Gonzalez allowed four hits and one run with five strikeouts and two walks in 7 1/3 innings, while counterpart Madison Bumgarner lasted seven frames, also giving up a run on four hits while fanning five and walking two ... The loss snapped San Francisco's five-game home win streak ... Scutaro's 19-game hit streak came to an end with an 0-for-3 performance.