Alex Wood showed a bit of youth and temper when he cursed out umpire C.B. Bucknor after being ejected in the fifth inning Wednesday, but his fit of indignation seemed to give the Braves a much-needed spark at Nationals Park.

Homers by Dan Uggla and Justin Upton fueled a three-run sixth inning that erased a two-run deficit and sent the Braves to a 5-2 win against Washington, reducing the Braves’ National League East magic number from four to two.

“We knew we had to get this one,” said Upton, whose two-run homer put the Braves ahead 3-2, a lead they wouldn’t relinquish.

Wood, who regretted the behavior that got him thrown out of the game, said he didn’t know if his actions had anything to do with the previously moribund offense having a three-run outburst in the next inning.

“I don’t know if that’s what happened, but it definitely makes me feel a little better that they ended up scoring some runs and winning the game,” he said. “There’s no doubt, tonight was a huge win for us, and hopefully how we played in the last half of that game will translate into how we play the rest of the season going into the playoffs.”

The Braves could clinch their first division title since 2005 as soon as Friday in a series opener against the Cubs at Wrigley Field. Any combination of Braves wins and Nationals losses totaling two gives the Braves the crown.

While the Braves are off Thursday, the Nationals open a four-game home series against Miami. The Braves had lost three in a row and nine of 13 before Wednesday, and seen their lead over St. Louis for the NL’s best record trimmed to one game.

The resurgent Nationals, trying to overcome long odds for a wild-card spot, got five near-perfect innings from Ross Ohlendorf (4-1). But a questionable call by Bucknor and Wood’s reaction awoke the slumbering Braves, and Craig Kimbrel pitched a perfect ninth inning for his 48th save, a day after he blew one for the first time in four months.

Wood limited the Nationals to four singles and no walks through four scoreless innings, then got in a jam in the fifth after a leadoff single, a sacrifice bunt and an error by first baseman Freddie Freeman put runners on the corners with one out.

Ryan Zimmerman walked to load the bases and bring up Jayson Werth, one of baseball’s hotter hitters. Wood, 22, got ahead of Werth, then saw him foul off a couple of two-strike pitches before taking a full-count pitch on the inside edge.

Werth immediately flicked his bat and headed to first base before Bucknor even called it a ball. When the umpire did, Wood waved his glove in anger and said something to Bucknor. Bucknor appeared to warn him, and manager Fredi Gonzalez was ejected after he ran interference and got in the umpire’s face to argue.

“Obviously I couldn’t tell if it was a ball or strike from the dugout,” Gonzalez said. “The way the young man reacted — he has three months in the big leagues, he’s not going to overreact that way (if he didn’t think it was a strike). After coming up here and looking at it from two or three different angles, it was a tough pitch. But nevertheless, I thought it was a strike.”

The walk brought in the game’s first run, and Bryce Harper followed with a sacrifice fly for a 2-0 Nationals lead.

Bench coach Carlos Tosca came out to replace Wood, who said something to Bucknor as he walked off the mound. The ump ejected Wood, who became furious. Instead of walking directly to the dugout, Wood took a couple of steps in the direction of Bucknor and shouted a few expletives before exiting.

“It was just one of those things, I let my emotions get the best of me there in the latter part of that inning,” Wood said. “It was a big situation. I felt the call could have gone the other way, and I kind of did some things, said some things I probably shouldn’t have said. Immediately regretted it once I got inside (the clubhouse)….

“I thought I made a pitch and I didn’t, and I reacted probably the complete opposite way than I should have. I probably still would have been in the game if I didn’t react the way I did. I just hope there’s no hard feelings there.”

Whatever the case, it did seem to snap the rest of the Braves to attention, based on what happened in the next inning.

“I think it all kind of came together,” Uggla said. “Woody made a great pitch, didn’t go our way. I like seeing that fire out of a young kid like that. He expressed his displeasure over it. You know, that’s going to happen. It’s not going to be the last time it happens.”

Said Upton: “It definitely brought some energy to us. He was out there grinding for us and battling. Obviously he thought he had made the big pitch for us and it didn’t happen for him. He was fired up and we knew he wanted this one. We all wanted it. So we had to go get it.”

Reliever Kameron Loe got the third out, then Braves hitters went to work. Ohlendorf faced 15 through five, giving up only a fourth-inning single by Upton, who was erased when Freeman lined into a double play.

But in the sixth, Uggla led off by hitting Ohlendorf’s first-pitch fastball to the left-field seats, his 22nd homer but first since July 25. Uggla had been 8-for-81 with no extra-base hits in 30 games before going deep to cut the Nationals’ lead to 2-1.

Jordan Schafer followed with an well-placed bunt single and raced to third on Ohlendorf’s throwing error on the play. After Joey Terdoslavich struck out and Elliot Johnson popped out, it looked as if the Braves, 1-for-16 with runners in scoring position to that point in the series, might waste an opportunity to tie the score.

Upton had other ideas. He drove Ohlendorf’s first-pitch slider over the left-center wall for a two-run homer and a 3-2 lead. The Braves pushed it to 4-2 in the seventh on Brian McCann’s RBI double off the center-field wall and added a run the ninth on Schafer’s two-out infield single with runners at second and third.

“We struggled at home, we struggled yesterday in the first two games of the series,” Upton said. “So this was a big one for us. And the guys stepped up.”

Regarding the Wood incident, Gonzalez was concerned mostly about the pitcher’s immediate response to the ball 4 call, an animated reaction which would have gotten him ejected right away by plenty of other, more confrontational umpires.

“You want fiery emotions, but that’s something that (pitching coach) Roger (McDowell) and I will talk about,” Gonzalez said. “Whether you’re a rookie or a veteran, you don’t do that kind of stuff on the mound. But he was fired up. He made a hell of a pitch on Werth and he almost gets out of that jam….

“That’s something you learn from and control your emotion. I think some of our veteran guys will talk to him. I know I will talk to him because later on in his career, that same situation is going to happen in the fourth or fifth inning and you want him to finish the game. You don’t want him to lose his composure that way.

“We’re going to chalk it up as a young starter in an emotional game that we wanted to win, and he got himself a little excited.”