The Padres entered the game with 20 victories in their last 28 games. But they couldn't stop the Giants from winning their fifth consecutive game and ninth in their last 10.
San Francisco thus shrank its magic number for securing the division title to two. The Giants can officially capture the National League West for the eighth time since the 1969 inception of divisional play as early as Saturday, if they win again and Los Angeles loses.
"We deserve it," left fielder Gregor Blanco said. "We're hoping it will be tomorrow."
Whenever it is, the Giants want to confirm their trip to the Division Series by winning their game, not solely by benefiting from a Dodgers loss.
"It's in our hands," manager Bruce Bochy said. "When you're in this situation, you want to take care of business."
Sandoval has accomplished that recently. His 3-for-3 performance hiked his batting average in his last seven games to .451 (14-for-31).
He delivered his biggest hit in the sixth, culminating a two-out rally that began with Pagan's triple and continued with Scutaro's single. Sandoval drilled Cory Burns' first pitch over the right-field wall for his 12th homer.
"I've been seeing the ball well," Sandoval said. "I'm not going to lie to you."
San Diego manager Bud Black understood the truth.
"Sandoval is a natural hitter, he really is," Black said. "I've seen him since Day 1 since he got to the big leagues, and he's just a tough guy to pitch to."
Ryan Vogelsong (13-9) made this a truly complete evening for the Giants by returning to form. After recording a 10.31 ERA in his previous seven starts, the right-hander yielded one run and five hits in six innings.
"I'm going to sleep for the first time in about a month tonight, I can tell you that," said Vogelsong, who lost four of his previous six decisions. "Sometimes you have to look in the mirror and be honest with yourself, and the honest truth is, I haven't been very good for about a month."
Vogelsong attributed his improvement to sharpening his pitching mechanics.
"I've been trying to tweak some stuff for a while and I finally found something that felt comfortable, easy to repeat," he said. "Somehow I got kind of twisted around a little bit, so it took me a little while to get back into something that felt right."
Vogelsong insisted that he hasn't dwelled on whether he'll be included in the postseason starting rotation. Assuming the Giants rely on a four-man alignment, Bochy faces a tough decision in dropping a member of his current quintet.
"Things work themselves out," Vogelsong said. "If I'm not in the rotation, hopefully I'm in the bullpen. ... I said last year and I said it this year, my ultimate goal is to walk away with a ring."
After San Diego's Chase Headley belted his 29th homer with one out in the fourth inning to open the scoring, Crawford's one-out RBI single off Padres starter Casey Kelly (2-2) in the Giants' half of the inning tied the score.
The Giants forged ahead in the fifth after Scutaro drew a leadoff four-pitch walk and Sandoval singled. Up came Posey, who had popped up with the bases loaded to end the third inning. This time, he singled sharply to left field, scoring Scutaro.
San Francisco's defense preserved the lead in the sixth as relays by Blanco and Crawford retired Headley, who tried to score from first base on Yasmani Grandal's double. Posey's deftness punctuated the play, as he short-hopped Crawford's throw before making the tag.
"To me, that was the turning point in the game," Bochy said. "Those types of plays win ballgames for you."