Gregor Blanco drove in the winning run in the eighth inning as the San Francisco Giants took a 4-2 win over the San Diego Padres to open a four-game series.
Blanco finished the game 3-for-5 with a run scored, while Pablo Sandoval hit a solo home run and scored twice for the Giants, who had lost eight of nine coming into the game.
Madison Bumgarner (10-5) settled down from a rough first inning to pitch seven strong frames, giving up just four hits and two runs along with a walk and six strikeouts to win his third straight start.
"Early, he was getting under the ball and leaving pitches up. But he made a nice adjustment and gave us seven solid innings in a much, much-needed win," said Giants manager Bruce Bochy.
Carlos Quentin and Kyle Blanks each drove in a run for the Padres, who have lost 12 of their last 13 games. Jason Marquis started on the mound and gave up two runs on seven hits in 5 1/3 innings.
With Luke Gregerson (4-5) on the mound and the score tied in the eighth, Kensuke Tanaka singled and quickly stole second. Tanaka then moved to third on a Brandon Crawford groundout and Tony Abreu was hit by a pitch. Blanco then drilled a pitch to deep left and it hopped over the wall for an RBI ground- rule double. Abreu was caught in a rundown between third and home on a Marco Scutaro grounder, but Buster Posey punched a single to center for a 4-2 lead.
Sandy Rosario worked around a two-out single in the eighth, while Sergio Romo put the Padres down 1-2-3 in the ninth for his 21st save of the season.
The Padres jumped on top in the first as Chris Denorfia and Chase Headley put runners at the corners with back-to-back one-out singles. Quentin then doubled to score Denorfia and Jesus Guzman was issued an intentional walk to load the bases. Blanks then hit into a fielder's choice, scoring Headley for a 2-0 lead.
"That was our best opportunity to really stretch that lead," said San Diego manager Bud Black. "He's a really good pitcher and you have to take advantage of what he gives you. We did a decent job of that there, but we just couldn't get the big hit."
San Francisco left runners at first and third in the third inning, but got on the board in the fourth as Sandoval led off with his ninth home run of the season.
The Giants then tied the game in the sixth as Tanaka singled home Sandoval with the bases loaded and one out. Joe Thatcher then came on in relief and got Crawford to hit a grounder back to the mound for the force out at home, and Dale Thayer struck out Bumgarner to end the frame.
Bumgarner settled down after the rough first inning and set the Padres down in order from the second through the fifth inning. He gave up a two-out single to Quentin in the sixth, but then struck out Guzman.
San Francisco has won six of the 10 games against San Diego this season ... San Francisco was just 4-for-15 with runners in scoring position and stranded 12 men ... The Padres were 1-for-3 with RISP and left four.