The Cardinals took advantage of a much-maligned Giants bullpen in the bottom of the seventh.
Second baseman Kolten Wong was first in line, as he led off the inning with a walk. Pinch hitter Jhonny Peralta, in his first at-bat since being activated from the 10-day disabled list, then singled up the middle to push Wong to third.
Center fielder Dexter Fowler, who had tripled earlier in the game, then launched a three-run home run to right field to give the Cardinals a 5-3 lead.
The bomb was Fowler's sixth of the season and traveled an estimated 380 feet.