Alvarez hit a two-run homer in the third to give the Pirates a comfortable lead, added an RBI double in the fourth and then hit a 469-foot drive to centre in the sixth. He went 4 for 5 as Pittsburgh drew within two games of the Cardinals in the race for the NL's second wild-card spot.
McDonald (12-6) gave up two hits, walked one and struck out six to beat Jake Westbrook (13-10) for the second time in two weeks.
The Cardinals played most of the game without catcher Yadier Molina, who sustained neck, back and shoulder injuries in a violent collision at home plate with Josh Harrison.
MARLINS 9, NATIONALS 0
MIAMI (AP) — Stephen Strasburg gave up a career-high seven runs in five innings and first-place Washington's losing streak reached five games when the Nationals were beaten by Ricky Nolasco and last-place Miami.
Nolasco (10-12) allowed five hits in his third career shutout and eighth complete game.
Strasburg (15-6) came into the game with a streak of 27 consecutive scoreless innings against Miami in five starts since last September. But he gave up a homer to his second batter, Justin Ruggiano, and trailed 5-0 by the third inning.
Strasburg, who had won his past four starts, allowed five earned runs, gave up nine hits and struck out only three. He leads the NL with 186 strikeouts.
The youngster is expected to make perhaps four more starts before the Nationals shut him down for the year to protect his surgically repaired elbow.
The Nationals began the night with baseball's best record, but they're saddled with a losing streak that matches their season high.
REDS 5, DIAMONDBACKS 2
PHOENIX (AP) — Johnny Cueto scattered four hits over seven innings for his major league-leading 17th win and Cincinnati beat the slumping Arizona Diamondbacks.
Cueto (17-4) gave up two runs, struck out one and walked five for his eighth victory in nine decisions. The right-hander lowered his NL-leading ERA to 2.48.
Ryan Hanigan hit a two-run single and Todd Frazier added a two-run triple for the Reds, who won for the third time in four games and stretched their lead in the NL Central to seven games over St. Louis.
Jonathan Broxton pitched the eighth and Aroldis Chapman closed it out for his 33rd save and 25th straight, tied with Texas reliever Joe Nathan for the longest active streak in the majors.
Wade Miley (14-9) allowed three runs over seven innings for the Diamondbacks, who have lost five straight and seven of nine.
BRAVES 2, PADRES 0
SAN DIEGO (AP) — Kris Medlen extended his scoreless streak to 28 1-3 innings for Atlanta by holding San Diego to five singles over eight innings.
Medlen allowed only five baserunners and erased two of them on pickoffs at first base. He struck out nine to tie his career high and walked none.
Atlanta, the NL wild-card leader, ended the Padres' season-high eight-game winning streak.
Medlen (6-1) has not allowed a run since the second inning of a 9-3 victory against the New York Mets on Aug. 11. Five days after that, he threw his first complete game in a 6-0 victory against San Diego at Atlanta, allowing five hits.
Atlanta has won Medlen's last 17 starts dating to May 2010 and is 20-4 in his 24 career starts.
Craig Kimbrel pitched the ninth for his 32nd save in 34 chances.
Dan Uggla homered for his 1,000th hit and Chipper Jones had an RBI double off Andrew Werner (1-1), who went six innings in his second big league start.
METS 9, PHILLIES 5, 10 INNINGS
PHILADELPHIA (AP) — Ike Davis hit a tiebreaking double during a four-run 10th inning, Kelly Shoppach had a two-run homer and New York beat Philadelphia for its third straight victory.
Shoppach hit a tying double in the eighth and then connected off B.J. Rosenberg (0-2). Mike Baxter also hit a two-run shot for the Mets, who are 6-1 in Philadelphia this season.
It was the first time in 10 games New York scored more than three runs.
Ryan Howard hit a grand slam and Chase Utley had a solo shot for the Phillies, who had won four straight.
Bobby Parnell (4-3) tossed two scoreless innings for the win.
GIANTS 3, ASTROS 2
HOUSTON (AP) — Pinch-hitter Hector Sanchez delivered a go-ahead single in the ninth inning and San Francisco rallied to beat Houston.
The NL West leaders were down 2-1 entering the ninth. Brandon Belt singled off Wesley Wright to start the inning before pinch-hitter Joaquin Arias doubled off Wilton Lopez (5-3) to tie it. Sanchez completed the rally with his one-out liner to centre.
Houston took the lead on a wild pitch by Matt Cain in the eighth. Cain allowed two runs and six hits in 7 1-3 innings.
Santiago Casilla (5-5) got two outs and Sergio Romo threw a perfect ninth for his seventh save.
The loss dropped Astros interim manager Tony DeFrancesco to 1-7 and came in front of 13,516 fans — the smallest crowd in the history of Houston's 12-year-old ballpark.
ROCKIES 8, DODGERS 4
DENVER (AP) — Wilin Rosario homered among his three hits and drove in three runs, Tyler Chatwood pitched five effective innings and Colorado beat Los Angeles.
Andrew Brown had three hits for the Rockies, who have won eight of 10. Chatwood (4-3) allowed two earned runs and struck out four.
Hanley Ramirez homered for the Dodgers, who have lost three straight after winning their first game following a nine-player trade with Boston that brought Adrian Gonzalez and Josh Beckett to Los Angeles.
Dodgers centre fielder Matt Kemp left with a bruised right knee. Chris Capuano (11-10) gave up six runs and 10 hits in six innings.
BREWERS 4, CUBS 1
CHICAGO (AP) — Jeff Bianchi hit a three-run shot for his first big league homer to lead the Brewers over Chicago.
Bianchi went deep off Travis Wood (4-11) with two outs in the second for Milwaukee, which has won seven of eight and beaten the Cubs seven straight times.
Yovani Gallardo (14-8) won his seventh consecutive start, holding Chicago to three hits over seven innings and striking out nine. Gallardo has pitched at least seven innings in all six starts since July 31. He's held the Cubs to a single run in each of his last four appearances at Wrigley Field.
John Axford of Simcoe, Ont., finished for his 21st save in 29 chances.
Wood hit his third career homer but lost for the eighth time in nine starts despite limiting Milwaukee to three runs over seven innings. The Cubs have lost 21 of 27.