Vogelsong (14-9) worked six innings and the Giants survived a shaky ninth to win their third in a row.
Buster Posey opened the scoring for San Francisco in the second by leading off the inning with a triple and then coming in on an infield single from Hunter Pence.
All three runs were charged to Andrew Werner (2-3), who lasted 4 2/3 innings.
Santiago Casilla came on in the ninth with one out and nobody on and gave up singles to both Mark Kotsay and Yasmani Grandal. With the tying runs on base, Casilla got Carlos Quentin on a ground out to end the game and grab his 25th save.