SAN FRANCISCO (AP) Brandon Belt was happy the wind was blowing in.

Belt's routine fly ball to left field dropped next to Starling Marte for a tiebreaking double in the seventh inning Wednesday, lifting the San Francisco Giants over the Pittsburgh Pirates 2-1.

Pinch-hitter Miguel Gomez doubled against Tony Watson (5-3) leading off the inning, and Belt's opposite-field drive appeared catchable. But it fell in to Marte's side, a few feet from the warning track, on the sunny afternoon.

''He said he broke to the ball because he thought it was hit hard,'' Pirates manager Clint Hurdle said. ''When he put his eyes on the ball, he saw the wind knocked it down. What can you do? It happens.''

Marte said the sun and the wind contributed to the difficulty.

''I heard the sound of the ball off the bat and knew it was hit hard,'' he said. ''I took my eyes off the ball because of the sun, and when I looked back up I saw the wind had started to take it away.''

Giants starter Jeff Samardzija (5-11) allowed one run and four hits seven innings with eight strikeouts and two walks, winning for the first time since July 2. He had allowed 12 runs in his previous 10 1/3 innings.

''All you want to do is keep your team in the game, eat up innings for the bullpen and if you get a lead, protect it,'' Samardzija said.

In the second season of a $90 million, five-year contract, the 32-year-old right-hander expects to remain with the last-place Giants.

''I wasn't in any trade talks,'' he said. ''I love being here. Obviously it hasn't gone the way we wanted it to.''

Hunter Strickland pitched a one-hit eighth, and Sam Dyson finished with a perfect ninth for his sixth save in 10 chances. Dyson is perfect in six opportunities since the Giants acquired him from Texas.

Pirates starter Trevor Williams gave up one run and five hits in six innings. The Pirates have lost four of five following a six-game winning streak.

Joe Panik doubled in the first, advanced on a wild pitch and scored when Brandon Crawford hit into a forceout against Williams, who had walked his previous two batters.

John Jaso walked in the second, advanced on Francisco Cervelli's single and scored on Adam Frazier's double. After an intentional walk to Jordy Mercer loaded the bases, Samardzija made a bare-handed grab of Williams' high chopper on the third-base side of the mound and in a continuous motion threw to catcher Buster Posey for a forceout.

''He's an athlete,'' Hurdle said of the former Notre Dame football player. ''At one time he was the best wide receiver in Chicago, and that might include the pro team. It doesn't surprise me when he makes a play like that.''

TRAINER'S ROOM

Pirates: OF Gregory Polanco (hamstring) is resuming baseball activities. He is hitting and playing catch and riding on a stationary bike.

Giants: San Francisco selected the contract of OF Carlos Moncrief from Triple-A Sacramento, and will be used as a pinch-hitter and spot starter. ... RHP Johnny Cueto (blister) threw 45 pitches in a bullpen session before the game. He's scheduled to throw again Friday and if all goes well, will likely return to action. ... RHP Mark Melancon (right pronater strain) threw 30 pitches before the game and will throw again in Los Angeles either another bullpen or to hitters. He could start a rehab assignment soon after.

UP NEXT

Pirates: Chad Kuhl (3-7, 4.92 ERA) is to start Friday's series opener at San Diego. He's won his only start against the Padres.

Giants: LHP Matt Moore (3-10, 5.82 ERA) starts the series opener at the Los Angeles Dodgers on Friday. He's 2-2 in four starts at Dodger Stadium.

---

More AP baseball: https://apnews.com/tag/MLBbaseball

Copyright 2017 by STATS. Any commercial use or distribution without the express written consent of STATS is strictly prohibited.