ST. LOUIS -- The fireworks display awaited beyond center field Friday night, but the anticipation focused on the mound as the ninth inning teetered upon disaster.
The shutout had already been erased with two runs, the lead was cut to one and the Marlins still had the bases loaded with one out in the ninth when third baseman Matt Carpenter charged on a slowly hit grounder.
He quickly fired to second for one out, the turn to first from Daniel Descalso recorded a second and the Cardinals sealed a 3-2 win in front of 46,131 at Busch Stadium.
"It's a great play. He's always ready," Cards manager Mike Matheny said of Carpenter. "The game was right there in his hands, and none of us were surprised he makes the big play for us."
The Cardinals were desperate for the big play after closer Trevor Rosenthal entered the ninth with a three-run lead and watched the Marlins' offense come to life after starter Lance Lynn had avoided running into much trouble throughout the night.
Lynn, coming off an outing in which he lasted two innings and surrendered six runs, regained his form. The right-hander scattered five hits and struck out six while allowing just three baserunners to reach second base in 6 2/3 scoreless innings, leaving in the seventh after walking a pair.
Lynn allowed a leadoff walk in the fourth, but Yadier Molina erased it with a pickoff throw to first. A Marlins leadoff double in the sixth with the game still scoreless was stranded with a strikeout, lineout and popout.
Sam Freeman ended the seventh-inning threat, stranding the two baserunners Lynn walked.
"He did a nice job of limiting the damage," Matheny said. "He got into a little bit of trouble and Freeman did a really nice job of coming and helping him get out of it."
Lynn, when he has fallen on rough starts this season, has bounced back time and time again. He is now 3-1 this season in starts after allowing at least four runs, never surrendering more than two runs after such outings.
"When I'm successful, I show them the breaking pitches in the middle part of the game and then I go back to the fastball," Lynn said. "When it was all said and done tonight, I had a really good sinker, and when I have that, we're going to use it."
The Cardinals' offense, which struggled at times during the team's recent 10-game road trip, put runners in scoring position in just one inning Friday, but that proved to be enough.
Carpenter sent a 2-2 fastball from Marlins starter Nathan Eovaldi deep to right-center to begin the sixth, hitting the ball off the top of the outfield wall. Carpenter initially believed the hit to be a solo home run to break the tie, but umpires immediately ruled it in play, putting him at second with a double. A short crew-chief review confirmed the call.
While that one swing wouldn't provide early fireworks, it did prove to be a catalyst. Carpenter moved to third on a single by Matt Holliday, and he scored on a wild pitch. Two-out doubles from Molina and Oscar Taveras plated two more runs to give Lynn a three-run lead.
"We have depth, so that should lead to big innings," Matheny said. "Today that was a deciding inning. It's nice to see some guys get involved. Top to bottom we have guys that can do damage."
Pat Neshek pitched a shutout eighth despite allowing a pair of two-out singles, his 11th straight scoreless outing to lower his ERA to 0.79.
The ninth began to unravel from the onset. After Rosenthal loaded the bases with two singles and a hit batter, a fly ball to left field bounced off a sliding Holliday's glove to score one run. Rosenthal struck out the next hitter, but a full-count fastball to Marlins slugger Giancarlo Stanton missed the zone, walking him to bring in a second run.
That brought up Marlins third baseman Casey McGehee, who rolled over a changeup and hit it softly to Carpenter.
"It's a tough one. I'd like to have that at-bat over, I guess," McGehee said. "You've got to give him credit. He threw a pretty good changeup on that last pitch. I felt like I had a pitch to do the job with and I spoiled it, instead of getting the job done with one strike. But he's got good stuff and made a great pitch."
Rosenthal escaped with his 26th save of the season, capping a win that helped St. Louis move within four games of first-place Milwaukee in the National League Central. The Cardinals have now gained 2 1/2 games in three days.
The latest win didn't come without some angst when a late rally attempted to spoil Friday's fireworks.
"The bullpen got some work today," Matheny said. "But they did enough to get it done today."
Alex Halsted is an associate reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.