Jordan Walker hit a tiebreaking homer in the eighth inning and Paul Goldschmidt drove in three runs to lead the St. Louis Cardinals over the Philadelphia Phillies 6-5 on Sunday.
St. Louis avoided a season sweep after losing its first five meetings with the Phillies this year.
Alec Bohm homered for Philadelphia, which leads the NL wild-card race.
Walker homered off Seranthony Domínguez (4-5) with two outs to snap a 5-all tie.
Walker also made a diving catch in right field on a sinking liner off the bat of Kyle Schwarber to begin the game.
It was Walker's 16th home run and fifth game-winning RBI of the season.
John King (2-1) allowed one run in one inning for the win, and Ryan Helsley earned his 11th save in 15 opportunities.
Goldschmidt broke a 3-all tie with a solo homer in the fifth. Alec Burleson followed with a double and Nolan Arenado singled to push the St. Louis lead to 5-3.
Goldschmidt extended his on-base streak to 13 games.
Goldschmidt had a two-run double in the third.
Cardinals starter Dakota Hudson, who went 4-1 in August, permitted three runs and five hits in five innings.
Cardinals RHP Adam Wainwright (4-11, 7.95 ERA) goes for his 200th career win when he faces Milwaukee RHP Freddy Peralta (12-8, 3.79) in the opener of a four-game series Monday in St. Louis. Wainwright is expected to retire after this season.