SAN FRANCISCO -- A hot Jacob deGrom faced a cold San Francisco Giants team on Saturday night.
It was borderline unfair.
The reigning National League Player of the Week pitched his third consecutive masterpiece, and Wilmer Flores capped an eighth-inning uprising with a run-scoring double, delivering the New York Mets a 5-2 victory over the Giants.
"When he's on, he's as good as anybody in the game," Giants manager Bruce Bochy said of deGrom, who completed eight innings for a third consecutive start. "And he was on today."
Jay Bruce broke a 1-1 tie in the eighth with an RBI double for the Mets, who won a second straight in San Francisco after having opened a 10-game trip with four consecutive losses against the Los Angeles Dodgers.
"I said this before: He had that outing when he struggled (June 6 at Texas) and he's come back after that, made the necessary adjustments and he's been lights out," Bruce said of deGrom. "That's what an ace does."
The loss was the Giants' 50th of the year, making them the first team to reach the half-century mark this season.
"It is hard to believe," Bochy said of the 50 losses. "I don't know if anybody saw this coming. Hard to make sense of it. It can be embarrassing."
Right-hander Sam Dyson replaced Cueto to start the eighth, and Curtis Granderson greeted him with a triple to get the game-winning rally in motion.
After Asdrubal Cabrera walked and Yoenis Cespedes struck out, Bruce smacked a Steven Okert pitch into right field to plate Granderson with the go-ahead run.
One out later, Flores sliced a double to right off the Giants' third pitcher of the inning, right-hander George Kontos, to make it 3-1.
Dyson (1-7) was charged with the loss, his first since joining the Giants.
The Mets tacked on two insurance runs in the ninth, the first coming when Michael Conforto, pinch hitting for deGrom, singled in Jose Reyes, who had opened the inning with a triple off right-hander Kyle Crick.
A two-out wild pitch by Crick allowed Conforto to score, increasing the New York lead to 5-1.
It was more than deGrom (7-3) needed.
"That's what I want to do every time out there," he said of the eight-inning effort. "That's what I expect of myself."
In a pitching rematch of Game 2 of the 2015 World Series, a game Cueto won for the Kansas City Royals, deGrom limited the Giants to four hits in eight innings while running his record to 3-0 with a 0.72 ERA in his last three starts. He walked one and struck out seven.
"You figured it would be a low-scoring game with those two guys going," Bochy said of deGrom and Cueto. "The (Giants) bullpen struggled tonight."
Right-hander Addison Reed surrendered a two-out, run-scoring single to Brandon Crawford in the bottom of the ninth before wrapping up the win.
Cueto did not get a decision after allowing one run and five hits in seven innings. He walked three and struck out three.
"Thank God," he blurted out afterward. "I think I'm in rhythm now."
Flores' homer, his seventh of the season, opened the scoring in the fourth inning. He finished with two hits and two RBIs for the Mets, who had five of their 10 hits go for extra bases.
Cabrera contributed a double and a single for New York.
Belt's home run, his 14th, led off the seventh and drew the Giants even at 1-1.
Buster Posey had a pair of singles for San Francisco, which has lost 11 of its last 12 overall and nine of its last 10 at home.
NOTES: The Mets have hit 23 home runs in their last 13 games and 42 in the month of June. Their franchise record for homers in a month is 45, set in August 2015 and tied in August 2016. ... The Mets lead the majors in homers on the road this season with 64. ... The Giants never previously in franchise history had lost a 50th game until July 8. ... The San Francisco bullpen has allowed at least one run in 47 of the team's 77 games. The Giants have gone 11-36 in those games. ... Giants 3B Ryder Jones went 0-for-4 in his major league debut. He was promoted from Triple-A Sacramento before the game, replacing 3B/OF Aaron Hill, who was designated for assignment.