Alvarez’s hit capped a four-run fourth inning against Lance Lynn (4-2) that helped the Pirates wipe out a 3-0 deficit.
Josh Harrison and Ike Davis each had two hits for the Pirates, who have won 11 of their last 14 games against the Cardinals in Pittsburgh. Harrison also hit an RBI single in the fourth.
Jared Hughes (2-0) retired all four batters he faced in relief of starter Edinson Volquez. Mark Melancon earned his fourth save with a scoreless ninth.
Pirates outfielder Starling Marte was lifted for a pinch-hitter because of tightness in his lower back.