The Giants scored twice in the first inning and then turned things over to Gaudin (4-1), who gave up three hits, walked no one and struck out eight in seven innings.
San Francisco sent four pitchers to the mound in the eighth to work out of a bases-loaded jam and Sergio Romo struck out one while retiring the side in order in the ninth for his 22nd save.
Those runs were charged to Ian Kennedy (3-7), who gave up five hits in seven innings.
2014: NFL Cheerleaders [PHOTOS]
Michael Sam cut from the Dallas Cowboys