Phoenix, AZ (SportsNetwork.com) - Michael Taylor's grand slam in the ninth inning lifted the Washington Nationals to a 9-6 win over the Arizona Diamondbacks in Wednesday's rubber game.

After Aaron Barrett (3-0) allowed a go-ahead run in the eighth, Washington mounted a rally in its last at-bat. Taylor replaced Bryce Harper in the lineup after he was ejected in the seventh inning.

Jayson Werth and Tyler Moore also homered for the Nats, who got all nine of their runs on homers. Starter Gio Gonzalez allowed five runs on nine hits in five innings.

Arizona pounded Washington pitchers for 14 hits but was a dismal 4-for-13 with runners in scoring position and left 12 runners on base. Paul Goldschmidt was a home run shy of the cycle in a three-hit game.

"They had a lot of opportunities, but we were able to get the last swing," said Nats manager Matt Williams.

Addison Reed (0-2) allowed the decisive home run in the ninth, and starter Jeremy Hellickson was charged with four runs in 5 2/3 innings.

Until Drew Storen recorded his 10th save in a 1-2-3 ninth, the Diamondbacks had at least one batter reach base in every inning. It appeared they would squander another run-scoring opportunity when Barrett struck out Goldschmidt for the second out, but back-to-back singles by A.J. Pollock and Yasmany Tomas gave Arizona a 6-5 lead.

Pinch-hitter Clint Robinson grounded out to start the ninth, but Reed got into trouble after that. Denard Span and Yunel Escobar singled, and Werth walked to set up Taylor's grand slam.

"Let's give that team credit," said Arizona manager Chip Hale. "They battled. A guy off the bench who got put in for a guy getting thrown out comes up with a big home run. That's pretty impressive."

Storen struck out the side in the bottom of the ninth to wrap up the series win.

Arizona went up 1-0 in the second on Nick Ahmed's two-out single, but that lead did not last long. Washington's two-out rally an inning later culminated in Werth's three-run home run.

The Diamondbacks responded immediately in the home half of the third. Goldschmidt's double cut Washington's lead to 3-2, and the Nationals conceded the tying run to record an out on Pollock's groundout. They brought the infield in for Aaron Hill's at-bat, but Ian Desmond's error allowed Hill to reach and Arizona to retake the lead.

Goldschmidt tripled to lead off the fifth and scored on a Pollock single, but another two-out home run in the sixth tied the game up. Pinch-hitting for Gonzalez, Moore lined a ball off the left field foul pole for his second home run of the season.

In the top of the seventh, Washington lost Harper when he was ejected for arguing a check-swing call. Home plate umpire Rob Drake made the call without consulting third base umpire Gabe Morales, and he also tossed Williams after his own argument.

Game Notes

Taylor's grand slam was his first plate appearance in the majors with the bases loaded ... Harper's ejection was the fourth in his career ... Ahmed struck out three times ... Washington continues its road trip Thursday with a four-game series at San Diego while Arizona travels to Philadelphia for three games starting Friday.