SAN FRANCISCO -- With 38 games left and three teams standing between the Mets and the second NL wild card, manager Terry Collins is convinced his ballclub can still make a serious push for the playoffs.
"We've had a tough time, but if you're going to win, your good players have to play good," Collins said. "We ride those guys. Hopefully this is the start of what we've been looking to do."
Cespedes homered for the third time in two days to help split the four-game series. It was also the 900th victory of Collins' career, making him the 10th active manager to reach the milestone.
Syndergaard (11-7) allowed two hits over eight innings for his second consecutive win following a six-start skid. It's Syndergaard's 20th career victory in 49 games, coming in what Collins called his best outing "in a long time."
Syndergaard faced one over the minimum and didn't allow a runner past first base.
That helped the Mets stay within 4 1/2 games of St. Louis for the second NL wild card.
"Today was the first day I went out there and actually relaxed and had fun," Syndergaard said. "I just kept things simple. The past month and a half I've been trying to think too far in advance."
Samardzija (10-9) held the Mets hitless until Curtis Granderson's leadoff double in the seventh. Cespedes followed with his 25th home run, a towering two-run blast that appeared to clear the stands in left field.
"I've had big power hitters but I haven't had anybody (where) the ball comes off the barrel of the bat like that," Collins said. "I mean nobody. The ball just jumps off his bat."
Familia retired three batters for his major league-leading 41st save.
The Giants dropped to second in the NL West after entering the day with a half-game lead on the Dodgers. Los Angeles beat Cincinnati earlier Sunday.
Samardzija remained winless in four career starts against the Mets despite taking a no-hitter into the seventh. Samardzija allowed only three hits and two runs over seven innings and struck out seven.
"I liked where he's at and he carried that into today's game," Giants manager Bruce Bochy said of Samardzija. "He pitched his heart out and ran into a hot hitter."
The duel between Syndergaard and Samardzija was in stark contrast to the first three games of this series, when the teams combined for 40 runs. Only two runners from either team reached second base Sunday, and both scored.
San Francisco's first two baserunners were thrown out trying to steal second. Catcher Rene Rivera caught Trevor Brown in the third and Eduardo Nunez in the fourth. Prior to that, opponents had successfully stolen 40 bases in 44 attempts against New York with Syndergaard on the mound.
The Giants also made a pair of sparkling defensive plays. Brandon Crawford made a diving stop on Jose Reyes' sharp liner in the first inning, then second baseman Joe Panik robbed Reyes of an infield single with two outs in the sixth when he fielded a slow grounder and flipped it to first base with his glove.
STOP, DROP AND ROLL
Mets third base coach Tim Teufel had to react quickly to avoid being hit by a line drive from left-handed hitting James Loney in the fifth. The ball narrowly missed Teufel as he dropped to the grass on his back.
Mets: Jay Bruce was back in the lineup after being held out Saturday to rest.
Giants: Buster Posey did not start but had a pinch-hit single in the ninth. ... OF Angel Pagan was kept out of the lineup with tightness in his groin. Pagan has the longest active hitting streak in the majors at 18 games.
Mets: LHP Jon Niese (8-7) pitches the opener of a three-game series in St. Louis on Tuesday. Niese has given up 25 home runs this season, second-most in the NL.
Giants: Madison Bumgarner (12-7) faces the Dodgers on Tuesday to begin a key series in Los Angeles between the top two teams in the NL West. Bumgarner is winless in two previous starts against the Dodgers this season.