PHOENIX — Michael Taylor began stretching in the seventh inning, figuring he might be called in to pinch run in a tight game.
He got more than that when Bryce Harper was ejected, and it worked out pretty well for him and the Washington Nationals.
Taylor hit his first career grand slam in the ninth after Harper was ejected two innings earlier, lifting the Nationals to a 9-6 win over the Arizona Diamondbacks on Wednesday.
"I was ready to go and was able to get an at-bat," Taylor said.
One the Nationals needed.
Gio Gonzalez struggled with his command and allowed five runs in five innings to put the Nationals in a hole.
Washington rallied to tie it behind Jayson Werth's three-run homer and pinch hitter Tyler Moore's two -run shot, but lost Harper and manager Matt Williams in the seventh for arguing a check swing call.
The Nationals then lost the lead in the eighth, when pinch hitter Yasmany Tomas lined a run-scoring single off Aaron Barrett (2-2) to make it 6-5.
But, whether they like it or not — taking a lead and holding it is much better — the Nationals have become adept at coming from behind and did it again.
Denard Span and Yunel Escobar opened the ninth inning with singles, then Werth worked a walk to load the bases against Addison Reed (0-2).
Instead of Harper, their star player, coming to the plate, it was a rookie in his first career at-bat with the bases loaded. Taylor made the most of it, hitting his first career grand slam over the yellow line in center.
Drew Storen finished off the latest comeback with a perfect ninth for his 10th save, sending the Nationals to their fifth straight series win.
"I always like our chances," Werth said. "We've come from behind a lot, so I don't feel like we're ever out of it."
The Diamondbacks had plenty of chances, only to let many of them slip away.
Arizona had 14 hits after getting 16 the night before, but failed to make the most of their opportunities, stranding 12 runners.
Paul Goldschmidt had three to finish a homer short of the cycle and A.J. Pollock had two RBIs for the Diamondbacks.
"Let's give that team credit. They battled," Arizona manager Chip Hale said. "A guy off the bench comes up with a big home run. That's pretty impressive."
Werth has gotten off to a slow start after offseason shoulder surgery, hitting .187 with three extra-base hits in 24 games heading into Wednesday.
He had been working on shortening his swing to get his timing back and it paid off in the third inning, when he sent a towering drive off Jeremy Hellickson into the overhang seats in left-center.
"It was good to see the ball go over the wall," Werth said.
Hellickson was replaced by Randall Delgado in the sixth inning and Moore hit his second pitch off the foul pole in left for a two-run homer that tied the game at 5.
Hellickson allowed four runs on four hits in 5 2-3 innings.
"Felt like I was good today, just want to have those two-out walks back," Hellickson said.
Gonzalez was sharp his previous two outings, allowing two earned runs while striking out 17 in 14 innings.
The left-hander gave up a run-scoring single to Arizona's Nick Ahmed in the second inning and ran into trouble in the third, giving up three runs on Goldschmidt's double, Pollock's groundout and an error by shortstop Ian Desmond.
Arizona went up 5-3 in the fifth inning after Pollock followed Goldschmidt's triple with a run-scoring single.
Gonzalez allowed nine hits and struck out three with three walks.
"Generally when he's not commanding, (his) pitch count gets up and the ball sails off the plate a little bit," Williams said. "That was a little bit of the case today."
Taylor's grand slam was the seventh by the Nationals in the ninth inning since 2005. ... Goldschmidt was one hit away from the cycle for the ninth time — second needing a homer. ... Harper was ejected for the fourth time, first since 2013. Williams was tossed for the third time as Washington's manager.
Nationals: RHP Doug Fister has allowed two earned runs over 13 innings in two May starts headed into Thursday's game at San Diego.
Diamondbacks: RHP Chase Anderson, who will start against Philadelphia on Friday, is winless his last seven starts and has not won on the road since June 3, 2014, at Colorado.
Diamondbacks: RHP David Hernandez, who's recovering from Tommy John surgery, was scheduled to throw in an extended spring training game against Milwaukee.