The home run by Alvarez in the sixth combined with four one-run rallies to allow Pittsburgh to escape with one win in the three-game series. The Cardinals had fattened their major-league-best team batting average with 30 hits and 22 runs in winning the first two games versus the Pirates.
But Pirates starter Erik Bedard (2-4) settled down and allowed two more hits over his five-inning outing.
Pittsburgh chipped away at St. Louis starter Jake Westbrook (3-2), who gave up four runs and nine hits in 6 1/3 innings.
Clint Barnes doubled in the first Pirate run in the fourth and Alvarez hit his seventh home run of the season in the sixth. Pittsburgh added a run on an out in the seventh, had another RBI double by Barnes in the eighth and a run-scoring single by Jose Tabata in the ninth for a 6-2 lead.
St. Louis got a run-scoring double from Allen Craig in the ninth that completed the scoring.
Exploding whale video goes viral on Internet
Couple calls 9-1-1 over missing hash browns; assault McDonanld's employees