NEW YORK -- Always calm on the mound, shaggy-haired rookie Jacob deGrom shook off all the zeros on the scoreboard and just went with the flow.
"I knew it at the fifth inning, so it was kind of a mental battle," deGrom said, "but I was sticking to the plan we had and I was going right after the guys."
With an energized crowd trading "Let's go Mets!" and "Let's go Giants!" chants, Pablo Sandoval doubled off deGrom with two outs in the top of the seventh for the game's first hit.
Peavy was perfect until Daniel Murphy hit a one-out double in the bottom of the seventh on a ball that left fielder Michael Morse misjudged. The Mets went on to score four runs to back deGrom (6-5), and the rookie won his fifth straight start.
Peavy (1-11) lost his 11th decision in a row, a streak that started with Boston.
"At the end of the day, you are trying to put up zeros and their guy did an outstanding job. I did not do enough," Peavy said.
This was the second time this season that a game didn't have any hits until there were two outs in the top of the seventh inning. Milwaukee's Matt Garza and Atlanta's Aaron Harang each had their no-hit bids broken up in the seventh on April 2.
Peavy had never taken a no-hit try past 5⅓ innings, but the 2007 NL Cy Young Award winner was dealing in his second start for San Francisco.
Murphy's double came soon after there was a brief delay when Sandoval ran into the third base railing chasing a foul ball.
Morse took his first step in on Murphy's line drive and couldn't recover, setting off the Mets' four-run inning. Travis d'Arnaud had a sacrifice fly, Juan Lagares hit an RBI single and Wilmer Flores added a two-run double.
"I was playing shallow in, and he hit it pretty good, it just kept going away towards the line," Morse said.
Both deGrom and Peavy got some help in keeping the bases clear until Brandon Belt walked with two outs in the fifth.
The Mets backed their starter with fine glovework, while Peavy benefited from a replay call. DeGrom, batting eighth in the Mets' lineup, was initially safe for an infield hit in the third, but the ruling was reversed.
DeGrom was pulled with one out in the eighth following pinch hitter Travis Ishikawa's two-run single. In a career-high 7⅓ innings, the lanky 26-year-old allowed four hits and two runs. He struck out seven.
Giants: Catcher Hector Sanchez, on the seven-day concussion list since July 26, went through a full workout. Manager Bruce Bochy says he's not sure if Sanchez will need rehab games before he returns.
Mets: Right-hander Jeremy Hefner made his fifth minor league start since having Tommy John surgery Aug. 28. He allowed two runs and two hits over four innings for Class A St. Lucie.
Giants: Madison Bumgarner (12-8) takes a 2-0 record with a 1.80 ERA into his fourth career start against the Mets. Bumgarner can hit, too. He has two grand slams this year.
Mets: The 41-year-old Bartolo Colon (10-8) is going for his 200th win.
Mets: Lagares, left fielder Eric Young Jr. and first baseman Lucas Duda all made spectacular catches early to help protect deGrom's gem. DeGrom was most grateful for Lagares' diving attempt on Sandoval's sinking liner to left-center that broke up the no-hit bid.
Giants: Hunter Pence made a sliding catch in foul territory in right field to help Peavy's perfect-game bid in the sixth inning.
Before the game, a fan injured his arm when he fell over a railing above the left-field wall and landed on the warning track.