ST. LOUIS -- Even though he wasn't in the starting lineup, Paul Goldschmidt didn't take the night off.
After beginning the game on the bench, Goldschmidt entered at first base in the ninth. Two innings later, he launched a 453-foot drive on a changeup from Adam Conley (1-7) for his fifth career walk-off home run.
"It was a tight game the whole time, so you know you're not starting, but being prepared to face a bullpen guy," Goldschmidt said. "I had a chance there in the ninth and struck out. It's nice to be able to come through and help us win."
St. Louis loaded the bases with none out in the 10th, but Sergio Romo escaped for Miami. He struck out Harrison Bader and got Marcell Ozuna to ground into an 8-4-3 double play started by center fielder JT Riddle as part of a five-man infield.
"Clearly that's not the recipe," Cardinals manager Mike Shildt said. "We just maybe need a better approach right there. We're not trying to do anything too special. They've got two outfielders and we've got a fly ball pitcher."
Cardinals starter Daniel Ponce de Leon gave up two hits over six shutout innings and was in line to earn his first major league win before Rojas' single tied it.
Ponce de Leon struck out six and walked one in the longest of his three starts this season. It was the first time the right-hander did not allow a run in nine career starts.
"I had all four of my pitches working," Ponce de Leon said. "The wins, it doesn't matter as long as it's in one of our team's columns."
John Gant (7-0) got the win with a perfect inning.
Miami has lost three of four.
Marlins right-hander Trevor Richards, from Aviston, Illinois -- 40 miles east of St. Louis -- went 5 2/3 innings before leaving after 108 pitches. He tied a season high with eight strikeouts and gave up four hits while walking three.
Richards pitched around a pair of walks in the third, but couldn't get out of more trouble in the sixth. Fowler's single, the third hit of the inning, snapped a 14-inning scoreless drought for the Cardinals and ended Richards' night as he left to boisterous applause from his hometown cheering section.
"Whenever I was walking off the field there it was pretty crazy," Richards said. "I looked up and it looked like half the stadium from my point of view was standing up. That's incredible."
ON THE BOARD
Rangel Ravelo started in Goldschmidt's spot at first base and got his first major league hit in the sixth.
Don Mattingly managed his 556th game on the Marlins bench, passing Fredi Gonzalez for most in franchise history.
"I like what we're doing and where we're trying to go," Mattingly said. "Obviously the record, you wouldn't look at it and think it's going in the right direction, but you really feel that way in the organization that things are going right. We're building the pitching we've been talking about. Our minor league system is better. So it's exciting what's going on and I'm glad to be a part of it."
Miami acquired OF Cesar Puello from the Angels for cash, and utilityman Rosell Herrera was designated for assignment. Puello grounded out as a pinch-hitter in the eighth.
Marlins: RHP Pablo Lopez (right shoulder strain) was placed on the 10-day injured list and LHP Jose Quijada was recalled from Triple-A New Orleans. ... 1B Garrett Cooper was a late scratch with a sore left triceps and was replaced in the lineup by Yadiel Rivera.
Cardinals: INF Yairo Munoz is expected to be activated from paternity leave Thursday.
Marlins: Zac Gallen makes his major league debut Thursday night in St. Louis against his former organization. The 23-year-old righty was 9-1 with a 1.77 ERA at Triple-A, striking out 112 in 91 1/3 innings. He was traded by the Cardinals to Miami in the deal for Ozuna after the 2017 season.
Cardinals: Plan to reinstate veteran right-hander Adam Wainwright (5-6, 4.46 ERA) from the injured list in the finale of a four-game series. Wainwright strained his left hamstring running the bases June 9. He has two shutouts in 11 career starts against Miami.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
With another ninth-inning nightmare, Cubs' road woes could be their undoing
Two straight devastating walk-off losses in Philly and Pittsburgh make it clear: If the Cubs can't find a way to win away from Wrigley, they won't find their way into October.
Montgomery outpitches Syndergaard as Royals top Mets 4-1
Mike Montgomery outpitched Noah Syndergaard, and the Kansas City Royals ended their scoreless drought Friday night in a 4-1 victory over the New York Mets.
Rockies use strong outing by Jon Gray to beat Miami 3-0
Jon Gray struck out seven in eight strong innings and Nolan Arenado and Ryan McMahon homered for the second straight game, leading the Colorado Rockies to a 3-0 win over the Miami Marlins on Friday night.
Homers by Kepler, Schoop lead Twins past Rangers 4-3
Max Kepler and Jonathan Schoop hit two-run home runs to lead the Minnesota Twins to a 4-3 win over the Texas Rangers on Friday night.
Kepler, Schoop homer to beat Rangers in Arlington
Max Kepler hits a home run to right field in the fourth inning and Jonathan Schoop hits one to right in the seventh to lift the Twins over the Rangers.
Bellinger hits 41st homer, Dodgers beat Braves 8-3
Cody Bellinger hit his 41st home run, Max Muncy and Justin Turner connected against reliever Sean Newcomb in the seventh inning, and the Los Angeles Dodgers beat the Atlanta Braves 8-3 Friday night in a matchup of NL division leaders.