Bumgarner (13-9) retired 12 of the first 13 batters he faced, walking the other. Josh Satin doubled to open the fourth and scored on a Daniel Murphy single for the only run Bumgarner allowed.
He walked three and struck out 10. Three of the strikeouts came in the fifth inning.
Javier Lopez was brought in to get the final two outs and earned his first save.
The Giants had only marginally better luck against New York starter Jon Niese (7-8), who surrendered two runs and seven hits in seven innings. He walked two and had four strikeouts.
San Francisco clumped together three of its hits in the fourth inning. Hector Sanchez doubled with one out and Joaquin Arias followed with a single. Juan Perez contributed an RBI base hit and Ehire Adrianza got Arias home with a groundout for a 2-0 lead.
Celebrity Breakups and divorces of 2014 [PHOTOS]