Buster Posey returned from a day off to hit a sacrifice fly, while Tyler Colvin and Brandon Hicks each hit RBI singles in a stretch of four straight base hits with two outs in the first against Jacob Turner.
Staked to an early lead, Vogelsong (2-2) struck out six in seven innings as the Giants concluded a season-long stretch with 17 games in as many days. San Francisco avoided its first three-game home losing streak.
Turner (0-2) is still searching for his first road win, falling to 0-11 in 18 career road starts.
Sandoval connected for his third home run with two outs in the fifth, his first since April 13 against the Rockies. He has struggled so far in a contract year.
Christian Yelich’s RBI groundout off Jeremy Affeldt in the eighth accounted for Miami’s run. Sergio Romo pitched the ninth for his 15th save.
A day after San Francisco was shut out 5-0 — its second shutout in five games — and went 0 for 6 with runners in scoring position and stranded nine, the Giants jumped on Turner right away.
The right-hander hit Gregor Blanco to begin the bottom of the first and Blanco stole second, then Posey’s sacrifice fly two batters later put the Giants on the board. Eight of San Francisco’s 15 runs in the series came with two outs.
Vogelsong did his part, and got some help from the defense with a double play and caught stealing.
The pitcher also had his third hit of the year with a second-inning single.
Vogelsong allowed five hits, struck out at least six for the third time in four May outings, and walked one for his second win of the season. His other victory came May 3 at Atlanta.
Both teams ended grueling May stretches, and Miami slugger Giancarlo Stanton didn’t play until late.
The Marlins wrapped up their season-long 11-game road trip out West with just their third loss in the past 15 meetings at AT&T Park, where Miami has its best road record since 2011. The club heads home to put its 17-5 record at Marlins Park on the line against the Phillies.
Giants center fielder Angel Pagan had an MRI on his bruised left shoulder, which he hurt trying for a diving catch Saturday. The hope is after sitting out Sunday coupled with Monday’s day off he could be ready to play Tuesday at Colorado.
NOTES: San Francisco RHP Tim Hudson threw at a higher intensity off flat ground as he nurses a strained left hip that forced him to miss his Friday start. He will have a bullpen session Tuesday ahead of his scheduled start Thursday at Coors Field. ... Giants RF Hunter Pence became the active leader in games played when Texas slugger Prince Fielder sat out Saturday to have his streak end at 547. Pence has appeared in 351 straight games with 216 consecutive starts. He leads the majors in innings played with 409 2-3.