Eight of New York's runs came with two outs.
Chris Young (3-5) muzzled the Giants over seven innings for the win. Young, who was 0-4 July 4, held San Francisco to one run on four hits and struck out four.
Hunter Pence drove in the only run for the Giants. Melky Cabrera had three of San Francisco's four hits.
Barry Zito (4-4) took the loss in a 4 1/3-inning start in which he was roughed up for seven runs on six hits.