Nolan Arenado and Edmundo Sosa homered to back Adam Wainwright's fourth straight winning decision, Paul Goldschmidt hit a two-run single in the fourth inning, and St. Louis beat San Francisco 6-5 on Tuesday night.
St. Louis left fielder Dylan Carlson made a tremendous game-ending catch at the wall with runners on first and third.
Yadier Molina added a run-scoring single in the seventh before Sosa connected in the eighth. The Giants scored twice in the bottom half, getting Mike Yastrzemski's RBI single and a double by Wilmer Flores.
Genesis Cabrera allowed two baserunners in the ninth, including a four-pitch walk to Donovan Solano, then gave way to Justin Miller one out later and he finished for his first save after Carlson's catch on a long fly by Jason Vosler.
Arenado hit a two-run homer in the first off Johnny Cueto (6-5) before Brandon Crawford's two-run single in the third tied it.
Wainwright (7-5) came out on top pitching opposite Cueto for the fifth time, having beaten the Giants right-hander twice when he was with Cincinnati while losing two starts in 2016 - Cueto's first year in San Francisco.
Crawford had an RBI double with one out in the fifth but Wainwright escaped further damage.
Johan Oviedo (0-4, 5.14 ERA) still seeks his first win of the season pitching the series finale for St. Louis opposite Giants LHP Alex Wood (7-3, 3.89), trying to win his third straight decision.