ST. LOUIS (AP) Even though he wasn't in the starting lineup, Paul Goldschmidt didn't take the night off.
Dexter Fowler had an RBI single in the sixth for the Cardinals, who won for the seventh time in 11 games. Miguel Rojas tied it with a single in the eighth off reliever Carlos Martinez.
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
Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.