ST. LOUIS -- Following the majors' second-longest game of the year Sunday, New York Mets manager Terry Collins asked about a dozen media members a question as they left his cramped office.

"Do you get paid double or triple time for this?" he said, drawing laughs.


Collins had reason to smile after New York overcame wretched hitting with runners in scoring position to pull out a 3-1, 18-inning win over the St. Louis Cardinals at Busch Stadium.


The Mets (48-44) won despite going an unthinkable 1-for-26 with runners in scoring position and stranding 25 runners, 17 in scoring position, during the 5-hour, 55-minute marathon.


"That's not a good stat," Collins said. "I've never seen more flying helmets in my life coming down the tunnel."


New York's frustration was replaced by relief and then muted celebration after it finally broke through against St. Louis All-Star Carlos Martinez (10-4), working his fourth inning in his first relief stint since Opening Night on April 5.


Second baseman Wilmer Flores and right fielder Curtis Granderson singled. Catcher Kevin Plawecki's sacrifice bunt was misplayed by Martinez for an error, filling the bases. Shortstop Ruben Tejada snapped the tie with a sacrifice fly to right that also moved Granderson to third.


Left fielder Eric Campbell scored Granderson with a squeeze bunt for insurance.


Carlos Torres (3-4), the Mets' seventh pitcher, worked a clean 18th to wrap up the win.


New York could have closed it out after Plawecki produced its lone hit with a runner in scoring position, singling Granderson home in the 13th to break the scoring seal.


However, closer Jeurys Familia blew the save on his second pitch, second baseman Kolten Wong lofting a solo homer down the right field line that just avoided the leaping Granderson. It was Wong's 10th homer.


Familia did escape a second-and-third jam later in the inning with a strikeout of left fielder Tommy Pham, one of 30 K's between the teams. Sean Gilmartin followed with three scoreless innings, and Torres pitched the last two.


"The thought was, 'Let's get a couple of runs.' I was glad we were able to hang in there and beat a very good team," Gilmartin said.


The Cardinals stranded 14 runners and went 0-for-8 with runners in scoring position.


Neither starter was involved in the decision.


New York's Jon Niese pitched 7 2/3 shutout innings, giving up just five hits with a walk and three strikeouts. St. Louis' Tim Cooney worked 5 2/3 scoreless innings, permitting three hits and walking four while fanning seven.


Niese only had to deal with one runner at third base all day, inducing a flyout from Wong to end the fifth after Cooney singled center fielder Peter Bourjos to third with his second hit of the day.


Meanwhile, Cooney and seven relievers continually worked in and out of trouble. The Mets had baserunners in every inning but the first, but they failed over and over to produce hits that could have ended the game sooner.


Even so, New York managed to crawl within two games of Washington for first place in the National League East before it opens a three-game series with the Nationals on Monday night.


Meanwhile, the Cardinals (58-34) lost for only the 12th time in 45 home games. They take a day off before a two-game interleague road series with the Chicago White Sox.


"We can sure use the off day," said reliever Carlos Villanueva, who worked four innings of one-run ball before Martinez's appearance. "It doesn't matter what you do if you don't win, but hey, we still won the series and we'll see you in Chicago."


NOTES: St. Louis RF Jason Heyward (cramping) didn't start Sunday off after leaving the Saturday night game following his fifth hit in the eighth inning. He struck out as a 14th-inning pinch hitter Sunday. Heyward required an ice bath and two IV bags after the Saturday game. ... New York announced that its Aug. 2 home game with Washington would be moved from 1:10 p.m. ET to 8:08 p.m. to accommodate ESPN's "Sunday Night Baseball" broadcast. ... The Cardinals also rested 3B Matt Carpenter. He grounded out as an eighth-inning pinch hitter, leaving him hitless in his past 17 at-bats. His average is down to .257.