The Giants scored twice in the eighth while snapping a four-game losing streak.
San Diego scored its two runs in the first inning, but Pablo Sandoval hit a solo homer in the fourth and then scored in the sixth on a base hit by Kensuke Tanaka to tie the game.
With Luke Gregerson (4-5) on the mound in the San Francisco eighth, Tanaka singled to open the inning, stole second and took third on a ground out by Brandon Crawford.
Pinch-hitter Tony Abreu was then hit by a pitch, after which Blanco produced a ground-rule double that brought in Tanaka with the go-ahead run.
All of that made a winner out of starter Madison Bumgarner (10-5), who survived seven innings while giving up two runs on four hits with six strikeouts. Sergio Romo worked the ninth for his 21st save.
Celebrity Families of 2014 [PHOTOS]