Two weeks ago, St. Louis infielder Matt Adams couldn't buy a hit.
He struggled just to make contact, and was mired in a 0-for-27 slump.
Those days are apparently over.
Adams hit a three-run homer in the eighth inning on Monday night to rally the Cardinals to an 8-7 victory over the Pittsburgh Pirates.
St. Louis, which overcame deficits of 4-0 and 6-4, moved two games ahead of the Los Angeles Dodgers in the race for the second wild card spot in the NL. Cincinnati beat Los Angeles 10-6 Monday.
Josh Harrison, Colin Moran and Starling Marte homered for Pittsburgh, which had its five-game winning streak snapped.
Adams homered off Edgar Santana (2-3) to erase a 6-4 deficit.
Adams, a former Cardinals player claimed off waivers from Washington on Aug. 21, hit his first homer at Busch Stadium since Sept. 27, 2016. It was his 21st of the season, a career high.
St. Louis manager Mike Shildt remained confident in Adams despite his struggles. Adams struck out eight times during his hitless skid, which spanned Aug. 5-28.
John Brebbia (2-3) picked up the victory for St. Louis, which has won two in a row.
Carlos Martinez, a former starter, recorded his third save in as many chances. He gave up run-scoring double to Josh Bell with two out. But Martinez got Francisco Cervelli to ground out to Paul DeJong at deep short to end the game. The bang-bang play at first was challenged, but Cervelli was ruled out after a 31-second video review.
DeJong ranged onto the outfield grass to make the play.
St. Louis right-hander Adam Wainwright, making his first start since May 13, gave up four runs on seven hits in five innings. He retired the last eight batters after giving up three runs in the third.
Shildt said Wainwright will get another start.
Matt Carpenter walked to start the go-ahead rally. Jose Martinez followed with a hit to set the stage for Adams' heroics.
Harrison broke a 4-4 tie with a solo shot off Chasen Shreve in sixth. Adam Frazier added a run-scoring hit for a 6-4 lead.
The Cardinals scored four times in the fourth off Trevor Williams, who had allowed just four earned runs over his previous nine starts. DeJong had a two-run double and scored on Harrison Bader's game-tying sacrifice fly.
Williams allowed six hits, struck out six and didn't walk a batter. He was making his sixth start of the season against St. Louis.
Williams came into the game on a big-time roll.
Moran homered in the second off Wainwright, who struck out three and did not walk a batter. Marte ripped a two-run shot in the third, his 19th of the season, for a 3-0 lead.
St. Louis is 33-18 under Shildt, who took over for Mike Matheny on July 15.