Washington Nationals center fielder Michael Taylor celebrates with third base coach Bob Henley after hitting a grand slam in the ninth inning Wednesday against the Diamondbacks. (Rick Scuteri/Associated Press)

Michael A. Taylor wasn’t expected to be in this situation on Wednesday: the bases loaded in the top of the ninth, the Washington Nationals trailing the Arizona Diamondbacks by a run and only one out. The cleanup spot in the lineup belonged to right fielder Bryce Harper, the team’s best and most powerful hitter. But Harper was ejected in the seventh inning for arguing a strikeout, and Taylor found himself at the plate in the game’s most crucial moment.

On the second pitch he saw, Taylor put a wicked swing on a 93-mph fastball from Arizona closer Addison Reed down in the strike zone, sending it into the center field concourse and the Nationals dugout into delirium and toward a 9-6 win.

“I was just thinking: Barrel up the ball, try not to do too much,” Taylor said after a wild celebration in the dugout. “I get in trouble sometimes when I try to crush the ball and end up fouling it off. So I just went up there looking for my pitch and tried not to miss it.”

In a back-and-forth game that featured blown leads, defensive mistakes, dramatic homers and game-changing pinch hits, Taylor’s first-career grand slam was the biggest moment of them all. Once Harper was ejected, there was a feeling in the back of some Nationals’ minds that his spot may come up with the game in the balance.

“Of course I want to be up there in that situation, but Mike . . . I guess I owe him a steak dinner,” Harper said. “He did what he did up there to get that [win]. Tipping my cap to Mikey, and I’m glad he came through for us.”

With six home runs and 13 RBI in four games, Bryce Harper is one of the most dangerous hitters in baseball. Post Sports Live discusses why Harper is finally playing up to his potential. (Post Sports Live/The Washington Post)

“That definitely worked out for us,” Jayson Werth added. “Mikey got him off the hook.”

Baseball works in funny ways. Having Harper in that situation would have been ideal for Manager Matt Williams.

“We got fortunate in that one,” Williams said. “They had a lot of opportunity. We allowed them a lot of opportunity. We were able to get the last swing.”

The Nationals entered the ninth trailing thanks to a shaky eighth inning by Aaron Barrett, who gave up a walk and a pair of singles — the second of which, from pinch hitter Yasmany Tomas, scored the go-ahead run.

The Nationals were playing from behind much of the afternoon, in part because of Gio Gonzalez’s uneven command. Their only lead before the ninth came on Werth’s three-run home run in the third. It lasted until the bottom of the inning, when Gonzalez gave up three runs of his own and Ian Desmond committed a fielding error, giving Arizona a 4-3 lead.

Gonzalez issued a two-out walk, and Williams ran out to the mound instead of pitching coach Steve McCatty. With the entire infield there, Williams animatedly commanded Gonzalez to throw more strikes. A fire lit under him, Gonzalez got out of the inning and fired two more innings, allowing one more run.

“I love it,” Gonzalez said. “A little kick in the butt doesn’t do anybody any harm.”

The Nationals are finally improving on their below .500 start to the season. Post Sports Live debates whether the team is playing up to its potential. (Post Sports Live/The Washington Post)

The deficit was 5-3 in the sixth when Williams sent Tyler Moore up to bat for Gonzalez, and Moore delivered a two-run pinch-hit home run to knot it at 5, his first pinch-hit blast since September 2012.

“It’s good to just come in, put the barrel to the ball and kind of give some life back to the team,” Moore said.

But tempers flared in the top of the seventh when Harper tried to check his swing on a two-strike slider from Oliver Perez. Home plate umpire Rob Drake called Harper out without asking for help from the third base umpire.

“I said, ‘You’re gonna have to check it,’ ” Harper said. “He said, ‘You’re really gonna act like that?’ I didn’t like that comment from him. I don’t like getting talked down to by an umpire.”

Williams ran out to protect Harper’s emotions from boiling over even more.

“He’s passionate,” Williams said. “But he’s been really good all season about it, but today it went over.”

The Nationals played with fire in the sixth and seventh inning, but Tanner Roark got out of his own jam in the sixth and got some help from Matt Thornton in the seventh. But this set the stage for Barrett’s eventful eighth inning and then Taylor’s heroics.

When Harper was tossed from the game, Taylor was already stretching, expecting to pinch-run late in the game. So he was glad to get an at-bat in the ninth. As he walked to the plate, Taylor told himself not to be too aggressive and chase any pitches outside of the strike zone. But if a pitch was over the plate, he was going to swing hard. And Taylor did, launching a ball into the seats much like Harper has done plenty of times this season.

“He probably would’ve hit it about 500 feet,” Taylor said with a laugh. “I was just trying to go up there and give a good at-bat.”