SAN FRANCISCO (AP) Matt Duffy hit a three-run double in San Francisco's decisive six-run third inning and a late run-scoring double, Jake Peavy worked into the sixth to end a three-start winless stretch, and the Giants beat the Nationals for the third straight game with a 12-6 win Saturday night.

Ian Desmond cleared the left-field bleachers with a second-inning leadoff home run that hit the walkway for one of the longest in the ballpark's 16-year history. It was estimated at 470 feet, the Giants said.

Peavy (3-5) allowed five runs on nine hits while outpitching Gio Gonzalez (9-5) as both teams played in a smoky haze from the Northern California wildfires.

More from FoxSports

Bryce Harper fouled a ball off his lower left leg in the seventh but stayed in the game as the stumbling Nationals lost their fifth straight game. Danny Espinosa homered in the ninth for his first career pinch-hit homer.

Kelby Tomlinson hit a two-run double in the fifth for San Francisco after his leadoff triple against Gonzalez in the third got the rally started.

Peavy had all the support he needed after the third inning, when Brandon Belt and Brandon Crawford added RBI singles. The right-hander won for the first time in four starts since beating Oakland on July 24.

Belt added an RBI double in the sixth as San Francisco has won three straight against the Nationals for the first time since June 4, 2009-May 25, 2010.

Duffy's double in the third came shortly after Nationals pitching coach Steve McCatty was ejected. McCatty made a mound visit after Tomlinson's triple and consecutive walks to Hector Sanchez and Peavy, then the coach began arguing balls and strikes.

Gonzalez was tagged for six runs on five hits in 2 2-3 innings and had his five-game winning streak snapped with his first loss in nine starts since June 15 at Tampa Bay. After tossing eight scoreless innings against the Los Angeles Dodgers in his last start, the lefty was knocked out after just 2 2-3 innings for his shortest appearance of the year.

He also was handed his first defeat by San Francisco since 2010, having gone 2-0 with a 1.42 ERA in his previous five outings. He limited the Giants to five hits over seven innings in a July 3 Nationals win.

Buster Posey added an RBI double in the fifth, then a run-scoring single. He got a break from catching duties and played first base, while Belt shifted to left field as manager Bruce Bochy wanted to keep his hot bat in the lineup.

LOOOONG INNING

The Giants' half of the third inning lasted 27 minutes, 38 seconds as San Francisco batted around.

TRAINER'S ROOM

Nationals: 1B Ryan Zimmerman had a day off but was used as a pinch-hitter.

Giants: RHP Mike Leake will be activated from the disabled list from a left hamstring strain to start Tuesday at St. Louis, meaning there will be a tough roster decision. San Francisco is also considering whether to give struggling RHP Matt Cain a break. ... RHP Tim Hudson, who pitched 2 2-3 scoreless innings in a rehab outing for Class-A San Jose, will continue throwing off a mound every other day as he prepares for a possible relief role in September once off the DL. ... CF Angel Pagan will rehab his knee injury in Arizona when the team leaves town.

UP NEXT

Nationals: Rookie RHP Joe Ross (3-4), who was born across the bay in Berkeley and attended high school in Oakland, makes his first start in the Bay Area. ''He's pitched in some big games for us,'' manager Matt Williams said. ''He'll be ready for it.''

Giants: World Series MVP Madison Bumgarner tries to follow up his five-hitter against Houston when he pitches the series finale against the Nationals. Bumgarner is just 2-5 with a 3.32 ERA in nine starts - including the postseason - against Washington. He has dropped his last three in the cross-country rivalry and the Giants have lost Bumgarner's previous five starts facing the Nationals.