MIAMI -- This could have gone terribly wrong for New York Mets left-hander Steven Matz.
With runners on the corners and two outs in the fifth inning, Matz faced Miami Marlins slugger Giancarlo Stanton, who had hit five homers in the past three games against the Mets.
Stanton, a right-handed hitter, had also entered Sunday having hit two homers in five career at-bats against Matz, making this a terrifying matchup all the way around for New York.
Matz, though, got Stanton to hit a weak groundout, and the Mets pitcher went on to pitch six scoreless innings as New York defeated Miami 3-0 on Sunday afternoon at Marlins Park.
"I just didn't want to miss fat," said Matz, who had fallen behind 2-0 in the count against Stanton. "I didn't want to make a mistake where he could extend his hands and hit the ball out of the ballpark with two runners on.
"(Catcher) Rene (Rivera) called a curveball. I threw it up there, and it was a fastball count so ... I was able to get him to ground out."
That was crucial on a day in which the Mets had little room for error. Jose Reyes' second triple since being activated on July 5 drove in the game's first run, and the Mets added two in the eighth on RBI singles from Yoenis Cespedes and James Loney.
Three New York relievers -- Hansel Robles, Addison Reed and Jeurys Familia -- each pitched a scoreless inning as the Mets posted their ninth shutout of the season.
It was Familia's 35th save of the season, which leads the majors. It was also his 51st consecutive save, which ties Jose Valverde for third in baseball history.
The win allowed the Mets (52-45) to take two out of three games in this weekend's series. The Marlins (53-45), who are second in the National League East, lead the Mets by a half-game.
"This was crunch time for us," Mets manager Terry Collins said. "We couldn't lose any more ground. We have to hang in there until we start to get healthy or we start to really get it clicking offensively. This was a good series for us to win."
Matz (8-6), who had been 0-5 with a 4.79 ERA in his previous nine outings, turned things around by striking out six and allowing just four hits and two walks. He got eight ground-ball outs and four fly-ball outs.
"That's probably the best I've seen him," Marlins manager Don Mattingly said. "He had a good fastball, and he got his off-speed over."
Collins said there was "late life" on Matz's fastball.
"He had a lot of swings and misses on his fastball," Collins said.
Overall, it was a big performance for Matz, who lowered his ERA to 3.36.
The same could be said about the job turned in by Marlins right-hander Jose Urena (1-2), who lowered his ERA from 6.23 to 5.34. Urena went six innings, allowing four hits, no walks and one run.
In his two starts since returning from Triple-A New Orleans, Urena has allowed two runs in 11 1/3 innings.
"I feel a little bit different and more focused," Urena said when asked to compare his pitching to previous major-league stints. "I'm trying to take advantage (of this opportunity)."
On Sunday, his one big mistake came on the pitch to Reyes, who slugged his two-out, opposite-field triple to left-center. That drove in Michael Conforto, who had singled.
Conforto, starting his first game in center field in the majors, made a diving catch going to his left on the first Marlins batter of the game, Miguel Rojas.
That set the tone for a game in which few batters had success. That included Marlins pinch hitter Ichiro Suzuki, who struck out on four pitches in the seventh inning. Suzuki remains four hits shy of the 3,000 milestone.
Conforto, demoted earlier this season after slumping, went 2-for-2 and is starting to look like the hitter who was so promising as a 2015 rookie.
"He's going to get it together," Collins said of Conforto, who is batting .233. "He's too good a hitter. He has flattened his swing instead of trying to get that little lift. And he creates so much back-spin, I know he's going to hit homers."
NOTES: After the game, Miami placed LHP Wei-Yin Chen (sore elbow) on the disabled list and recalled RHP Jarred Cosart from Triple-A New Orleans. Cosart will start on Monday against the Philadelphia Phillies. ... Miami gave Miguel Rojas his first career start at first base, a position he hadn't played in the majors before this season. ... The Mets rested slumping 2B Neil Walker and started Kelly Johnson. ... Marlins 2B Dee Gordon, who is due back from an 80-game performance-enhancing-drugs suspension on Thursday, is hitting .176 (3-for-17) during his minor-league rehab stint at New Orleans. He also has two steals in five games. ... Next up, the Mets start a nine-game homestand with a series against the St. Louis Cardinals that starts Monday. ... New York will retire the No. 31 jersey of ex-Mets C Mike Piazza on Saturday prior to their game against the Colorado Rockies.