McDonald (12-6) allowed only one runner to reach as far as second base in dominating the Cardinals. The right-hander yielded just two hits, issued a single walk and struck out six.
Alvarez cracked a two-run homer in the third inning and a solo shot in the sixth with a run-scoring double in between, while Clint Barmes knocked in a pair for the Pirates, who evened their three-game set.
The win pulled Pittsburgh to within two games of St. Louis for a National League wild card berth.
The loss was hung on Jake Westbrook (13-10), who coughed up seven runs on 11 hits in a five-inning outing for the Cardinals.
Celebrity Families of 2014 [PHOTOS]