SAN DIEGO -- Pablo Sandoval hit his first home run since May 21, and All-Star Madison Bumgarner settled down to allow just four hits in seven innings as the San Francisco Giants beat the San Diego Padres 4-2 Thursday night in a matchup of the worst teams in the weak NL West.
The defending World Series champion Giants, who snapped a four-game losing streak, have been in a free-fall since June 15. They had lost 19 of 24 games coming in and were a season-high 10 games under .500. They started the night two percentage points behind the Padres and ended it by jumping past San Diego into fourth place.
Bumgarner (10-5) allowed two runs on three hits in the first inning and then retired 14 in a row before Carlos Quentin singled with two outs in the sixth. The lefty struck out six and walked one.
The Giants are 2-8 in July, with Bumgarner getting both wins. Sergio Romo pitched the ninth for his 21st save in 24 chances.
The Padres have lost 16 of 19.
Sandoval got San Francisco's weak offence going in the fourth with a leadoff homer to right-centre off Jason Marquis, his ninth.
It was Sandoval's first homer in 101 at-bats. Sandoval, who was on the disabled list from June 9-24 with a strained left foot, was 6 of 55 (.109) before that at-bat.
The Giants had the bases loaded three times in the sixth and seventh innings but scored only one run.
Marquis took a 2-1 lead into the sixth and struck out Buster Posey leading off the inning before loading the bases and allowing Kensuke Tanaka's RBI single up the middle. Marquis made way for Joe Thatcher, who got Brandon Crawford to hit into a force at the plate. Dale Thayer came on and struck out Bumgarner to end the inning.
The Giants loaded the bases again in the seventh on two singles and a hit batsman, and Thayer again got out of trouble by striking out Belt to end it.
San Francisco finally broke through in the eighth with two runs and three hits off Luke Gregerson (4-5), including an RBI double by Blanco that bounced over the fence in left, and Posey's RBI single to left.
Bumgarner settled down after a rough first inning in which he allowed two runs on three hits. Quentin hit an RBI double and, after Jesus Guzman was intentionally walked to load the bases, Kyle Blanks drove in a run on a fielder's choice. Bumgarner got Logan Forsythe to line out to second to end the inning.
Marquis failed for the fifth time to get his 10th victory. He allowed two runs and seven hits in 5 1-3 innings, struck out three and walked two.
NOTES: The Giants have won 10 of Bumgarner's last 11 starts against the Padres. ... The four-game series continues Friday night when right-hander Sean O'Sullivan makes his debut for his hometown Padres against San Francisco RHP Chad Gaudin (2-1, 2.44 ERA). O'Sullivan, who graduated from Valhalla High in suburban El Cajon in 2005, was signed by the Padres as a minor league free agent in December. It will be his first big league start since Sept. 27, 2011, with the Royals. ... Padres 1B Yonder Alonso is expected to be in the starting lineup for Friday's game He has been on the disabled list since May 31 with a broken right hand.