NEW YORK (AP) — Madison Bumgarner hit an RBI double for the only earned run off Mets ace Jacob deGrom and topped him on the mound, too, pitching the San Francisco Giants past New York 3-1 Thursday.

In his first appearance in New York since tossing a four-hit shutout in the 2016 NL wild-card game, Bumgarner (5-5) allowed one run on five hits in eight innings. He struck out eight and walked none.

READ MORE: Steph Curry, Draymond Green Ready For Play-In Game; Warriors To Take On Lakers Wednesday Night

Bumgarner extended his scoreless streak at Citi Field to 33 innings before Todd Frazier homered to begin the seventh. The big lefty is 7-0 with a 1.42 ERA in eight starts against the Mets — he’s 5-0 with an 0.59 ERA in six starts at the Mets’ park.

DeGrom (8-8) went six innings and exited with a major league-best 1.71 ERA. He allowed two runs overall on four hits, striking out 10 with a season-high four walks.

DeGrom has often wound up with losses and no-decisions this season because the Mets haven’t scored much for him. He appears to be in a three-way race for the NL Cy Young Award with Philadelphia’s Aaron Nola and Washington’s Max Scherzer — Nola outdueled Scherzer at Nationals Park on Thursday afternoon.

Evan Longoria hit a solo homer in the eighth inning as the Giants concluded a 4-6 road trip.

The Giants manufactured their first run in the third when rookie Steven Duggar walked, stole second and advanced on a groundout. He scored when catcher Devin Mesoraco let a pitch to Longoria go off his glove for a passed ball.

Bumgarner doubled down the left field line one batter after deGrom thought he was out of the fourth inning. Nick Hundley checked his swing and deGrom took a few steps off the mound, but first base umpire Brian O’Nora ruled that Hundley did not swing.

Hundley walked and on the next pitch, Bumgarner hit a double beyond Frazier’s range at third. As deGrom went to cover the plate, he began yelling at plate umpire Tony Randazzo.

After getting the final out, deGrom flung some paper cups in the dugout along with his glove in frustration.

READ MORE: Demonstrators Call on San Francisco to Keep Great Highway Closed to Cars

Frazier hit his 14th homer in the seventh to make it 2-1. Bumgarner then hit Bautista with a pitch and gave up a single to Jeff McNeil, but got Kevin Plawecki to hit into a double play and struck out Michael Conforto on a full-count fastball.

Bumgarner entered the eighth at 95 pitches. He struck out pinch-hitter Jose Reyes, made a nifty snag of Amed Rosario’s comebacker to the mound and retired Austin Jackson on a groundout.

Will Smith worked around a two-out walk to Jose Bautista in the ninth for his 11th save in 13 opportunities.

TRAINER’S ROOM

Giants: C Buster Posey didn’t play. He is expected to catch Friday’s series opener against Texas. Posey is considering getting season-ending hip surgery. … RHP Jeff Samardzija (right shoulder inflammation) pitched four scoreless innings in a rehab start for Double-A Richmond Wednesday. Manager Bruce Bochy said Samardzija will be evaluated Friday in San Francisco but will likely need another rehab start.

Mets: Mesoraco left the game after the fourth inning with neck stiffness. … RF Jay Bruce (sore right hip), on the disabled list since June 19 is expected to be activated for Friday’s series opener against Washington. Manager Mickey Callaway said Bruce will see time at first base and right field. … Third base coach Glenn Sherlock was away from the team due to a family matter. He is expected to return Friday.

UP NEXT

Giants: RHP Dereck Rodriguez (6-1, 2.25 ERA) is set to come off the disabled list and will oppose Texas RHP Drew Hutchison (2-2, 5.71) Friday in San Francisco.

Mets: RHP Jason Vargas (3-8, 7.67 ERA) faces LHP Gio Gonzalez (7-10, 4.51 ERA) on Friday night to open a three-game series against Washington.

MORE NEWS: Marin County Steps Up Effort to Vaccinate Youth

© Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.