The Giants (31-31) won five of six games to move within 1 1/2 games of the National League West lead and concluded the stand in stirring fashion on Wednesday.
Alen Hanson's pinch-hit, two-run homer in the ninth inning erased a 4-2 deficit against Arizona and Brandon Crawford's two-out single in the 10th won it.
"The boys fought hard," Giants manager Bruce Bochy told the San Francisco Chronicle. "The whole game they kept coming back. Great win for us. It could be our best win this year."
The Giants' 10-game trip will include series against the Nationals, Miami Marlins and Los Angeles Dodgers. They are 5-17 at Washington since the start of the 2011 season and will face Stephen Strasburg, Gio Gonzalez and Max Scherzer for the three days.
San Francisco sends 25-year-old rookie Andrew Suarez (2-4, 4.74 ERA) against Strasburg (6-5, 3.20) in Friday's opener and Suarez is coming off his best outing of the season. The left-hander allowed three hits in seven shutout innings in a 2-0 win over the Philadelphia Phillies on June 2. He registered five strikeouts without a walk.
"I had a good feel for the ball today," Suarez told mlb.com after his longest start in the majors. "My curveball was good today. (Catcher Nick Hundley) called it a lot and I got some swing and misses on it. Usually it hasn't been like that. It's usually a get-me-over pitch and today it was a strikeout pitch."
His curveball and other pitches will be tested against the Nationals. Washington (35-25) pounded out 15 hits in an 11-2 rout of the Tampa Bay Rays on Wednesday and has won of 11 of 15.
Anthony Rendon celebrated his 28th birthday with four hits, three RBIs and three runs scored, upping his average from .250 to .268.
"It's just a matter of time before he gets his hits," Nationals manager Dave Martinez said. "He didn't get hits, but he was hitting the ball pretty decent. He had a good day today and I hope that he continues to do that."
Center fielder Michael A. Taylor went 3-for-5 with three RBIs.
With outfielder Adam Eaton (arthroscopic surgery May 10 on his left ankle) eligible to return to a suddenly crowded outfield as soon as Friday, Taylor is heating up at the right time. Since May 20, he has a .293/.349/.569 slash line and 10 RBIs.
Martinez has repeatedly expressed confidence in Taylor.
"I think a big thing for me is not focusing on the results," Taylor said. "Knowing I'm going to be in there the next day helps me go out there and just concentrate on swinging at good pitches and having quality at-bats."
At the other end of the spectrum for Washington is right fielder Bryce Harper, who is hitting .167 (3-for-18) in June with no homers, one walk and 11 strikeouts.
Strasberg is 3-2 with a 3.32 ERA in eight career starts versus the Giants. He allowed four runs (three earned) in 6 2/3 innings in his last start, a loss to Atlanta.
Posey sat out Wednesday's win, but he is slated to return Friday night.