Paul Goldschmidt hit a game-ending homer in the ninth inning and drove in both St. Louis runs as the Cardinals beat the Miami Marlins 2-1 on Tuesday night.

St. Louis has won two in a row against the Marlins after dropping nine of 10 overall.

More Images
St. Louis Cardinals' Paul Goldschmidt (46) is congratulated by third base coach Ron "Pop" Warner after hitting a game-ending home run during the ninth inning of the tema's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Paul Goldschmidt hit a game-ending homer in the ninth inning and drove in both St. Louis runs as the Cardinals beat the Miami Marlins 2-1 on Tuesday night.

St. Louis Cardinals' Paul Goldschmidt, left, is congratulated by teammates after hitting a home run during the ninth inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Goldschmidt, who had a tying RBI single in the sixth, led off the ninth and fell behind 1-2 in the count before he drilled a 98 mph fastball from Yimi Garcia (3-5) to right-center field for his sixth career walk-off home run. The previous one also came against the Marlins in June 2019 to give St. Louis a 2-1 victory in 11 innings.

St. Louis Cardinals' Paul Goldschmidt watches an RBI single during the sixth inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Goldschmidt tied the game with a two-out, two-strike hit in the sixth. Pinch-hitter Jose Rondon began the rally with a one-out single.

St. Louis Cardinals' Paul DeJong, right, is out at third as Miami Marlins shortstop Jazz Chisholm Jr. throws out Adam Wainwright at first during the eighth inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals' Paul DeJong, right, is out at third as Miami Marlins shortstop Jazz Chisholm Jr. throws out Adam Wainwright at first during the eighth inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals starting pitcher Kwang Hyun Kim throws during the third inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals starting pitcher Kwang Hyun Kim throws during the third inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals third baseman Nolan Arenado throws out Miami Marlins' Jesus Sanchez during the third inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals third baseman Nolan Arenado throws out Miami Marlins' Jesus Sanchez during the third inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins starting pitcher Trevor Rogers throws during the first inning of the team's baseball game against the St. Louis Cardinals on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins starting pitcher Trevor Rogers throws during the first inning of the team's baseball game against the St. Louis Cardinals on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals right fielder Lane Thomas catches a fly ball hit by Miami Marlins' Jazz Chisholm Jr. during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals right fielder Lane Thomas catches a fly ball hit by Miami Marlins' Jazz Chisholm Jr. during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins second baseman Jon Berti tags out St. Louis Cardinals' Tyler O'Neill on a steal attempt during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins second baseman Jon Berti tags out St. Louis Cardinals' Tyler O'Neill on a steal attempt during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami lost its third straight.

St. Louis Cardinals' Paul Goldschmidt (46) is congratulated by third base coach Ron "Pop" Warner after hitting a game-ending home run during the ninth inning of the tema's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals' Paul Goldschmidt (46) is congratulated by third base coach Ron "Pop" Warner after hitting a game-ending home run during the ninth inning of the tema's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Goldschmidt, who had a tying RBI single in the sixth, led off the ninth and fell behind 1-2 in the count before he drilled a 98 mph fastball from Yimi Garcia (3-5) to right-center field for his sixth career walk-off home run. The previous one also came against the Marlins in June 2019 to give St. Louis a 2-1 victory in 11 innings.

Alex Reyes (4-2) worked a scoreless ninth for the win.

Miami took a 1-0 lead on a run-scoring single by Adam Duvall in the third. He drove in Starling Marte, who walked to begin the inning

St. Louis Cardinals' Paul Goldschmidt, left, is congratulated by teammates after hitting a home run during the ninth inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals' Paul Goldschmidt, left, is congratulated by teammates after hitting a home run during the ninth inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Goldschmidt tied the game with a two-out, two-strike hit in the sixth. Pinch-hitter Jose Rondon began the rally with a one-out single.

Miami starter Trevor Rogers allowed one run and three hits over six innings. He struck out six and walked one. Rogers has held opponents to one run or none in eight of his 14 starts this season.

St. Louis starter Kwang Hyun Kim also gave up one run and three hits in six innings. He struck out six and walked five.

St. Louis Cardinals' Paul Goldschmidt watches an RBI single during the sixth inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals' Paul Goldschmidt watches an RBI single during the sixth inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals' Paul DeJong, right, is out at third as Miami Marlins shortstop Jazz Chisholm Jr. throws out Adam Wainwright at first during the eighth inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals' Paul DeJong, right, is out at third as Miami Marlins shortstop Jazz Chisholm Jr. throws out Adam Wainwright at first during the eighth inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals starting pitcher Kwang Hyun Kim throws during the third inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals starting pitcher Kwang Hyun Kim throws during the third inning of the team's baseball game against the Miami Marlins on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals third baseman Nolan Arenado throws out Miami Marlins' Jesus Sanchez during the third inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals third baseman Nolan Arenado throws out Miami Marlins' Jesus Sanchez during the third inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins starting pitcher Trevor Rogers throws during the first inning of the team's baseball game against the St. Louis Cardinals on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins starting pitcher Trevor Rogers throws during the first inning of the team's baseball game against the St. Louis Cardinals on Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals right fielder Lane Thomas catches a fly ball hit by Miami Marlins' Jazz Chisholm Jr. during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

St. Louis Cardinals right fielder Lane Thomas catches a fly ball hit by Miami Marlins' Jazz Chisholm Jr. during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins second baseman Jon Berti tags out St. Louis Cardinals' Tyler O'Neill on a steal attempt during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)

Miami Marlins second baseman Jon Berti tags out St. Louis Cardinals' Tyler O'Neill on a steal attempt during the second inning of a baseball game Tuesday, June 15, 2021, in St. Louis. (AP PhotoJoe Puetz)