Their offense has been the Braves’ primary weakness for the early part of the season, but it was shaky pitching and defense that threatened to do them in Friday night when they blew two leads against the Nationals.

Fortunately for the Braves, Justin Upton’s bat has heated up quickly. Upton’s third home run in two nights was a tying solo shot to straightaway center in the eighth inning, and the Braves pulled out a 7-6 win in the 10th inning on Upton’s two-out RBI single to shallow right field, which scored Jordan Schafer from first base.

Schafer, the fastest player on the team, pinch-ran for Chris Johnson after a two-out single, the third hit for Johnson.

“I’ve seen Schafe run before, so I was hoping he would (try to score),” Upton said. “I knew he had a chance if that ball got down and got away from him a little bit. That’s why we put the speed at first base, and he made a good play for us.”

Upton’s single bounced off the glove of right fielder Bryce Harper, who perhaps was rushed after seeing Schafer wasn’t stopping at third. Schafer was being waved home all the way, and the scorekeeper didn’t charge Harper with an error.

“He was running on the pitch and scored on a ball that was just 120 feet,” said manager Fredi Gonzalez, whose Braves snapped the Nationals’ four-game winning streak and pulled within one game of the National League East leaders with their third win in four games against Washington this season.

“And (third-base coach Doug Dascenzo) did a terrific job at third base, keeping him coming. I would have liked to see if Harper picks that ball up clean what kind of play at the plate – but it was a strange enough night without trying to get that one also,” Gonzalez said.

It was a wild game that featured multiple potential replay-review situations – only one went through the entire process — a three-run homer for each team, a collision on the bases, an umpire hit with a batted ball, and three Braves hit by pitches.

After Upton’s homer in the eighth, Craig Kimbrel struck out the side against the heart of the Nationals order in the ninth inning – Jayson Werth, Adam LaRoche and Ryan Zimmerman, all blown away.

“Any time you can keep your team in the ballgame and give your team a chance to win, it feels great,” Upton said of his home run. “These guys pick me up all the time. We pick each other up all the time.”

Luis Avilan worked around a one-out walk and a two-out intentional walk in the 10th by inducing an inning-ending groundout from Denard Span, setting the stage for the walk-off win – the 20th win for the Braves in their past 27 games against the Nationals.

“Yeah it was a weird game and guess what, we got to play these guys (15) more times,” Gonzalez said.

Upton homered off Tyler Clippard, who has been pummeled by the Braves like no other team for two seasons. Since the beginning of the 2013 season, Clippard has a 9.72 ERA with nine runs and four homers allowed in 8-1/3 innings of nine appearances against the Braves, and a 1.81 ERA and six homers allowed in 70 appearances against everyone else.

When Adam LaRoche tried to score from second base on a Jordan Walden wild pitch with two out in the seventh inning and the score 5-5, catcher Evan Gattis scrambled to retrieve the ball near the Natonals dugout and throw out LaRoche on a close play at the plate with Walden covering.

The play was reviewed and the called upheld. During the process, a replay was shown on the enormous hi-definition video board beyond center field, with Walden clearly appearing to make the tag before LaRoche’s foot touched the plate.

The Nationals wouldn’t be denied in the next inning, however. Harper led off the eighth with a drag-bunt single against reliever David Carpenter, who gave up another two-out single that hit the leg of second-base umpire Angel Hernandez, stopping the play. With runners at first and second, Denard Span singled to drive in the go-ahead run for a 6-5 lead.

It didn’t last long, as Upton teed off on Clippard in the bottom of the inning.

Braves starter Julio Teheran was charged with 10 hits and five runs in six innings, including three unearned runs after Dan Uggla’s two-out throwing error in the fifth inning. Ryan Zimmerman followed with a three-run homer for a 4-4 tie.

“Like we talked about earlier in the day, when you play a team that’s as good as (theirs) or us, it’s pretty equal, a mistake can cost you. And it did cost us today. Julio got behind the eight-ball there after we didn’t get the third out and Zimmerman hits a three-run homer to get them back in the game.”

Johnson, after wearing the figurative “golden sombrero” with an 0-for-4, four-strikeout game Thursday against the Mets, tossed it aside Friday with three hits Friday including a double, a tie-breaking single on a 10-pitch at-bat in the fifth inning, and his key two-out single in the 10th.

In the fifth, Johnson got behind in the count and fouled off four two-strike pitches before inside-outing a 95-mph fastball from Aaron Barret, sending it to right field to score Freddie Freeman from second for a 5-4 lead.

It was just the third Braves hit in 30 at-bats this season with a runner in scoring position and two outs. Johnson had previously been 0-for-9 with five strikeouts with runners in scoring position, including 0-for-4 with two outs.

Teheran gave up a lead for the second time in as many innings when Jose Lobaton doubled with one out in the sixth and came home on Kevin Frandsen’s pinch-hit single to make the score 5-5.

“They know what I’m going to throw and what’s my best pitches,” said Teheran, who said he didn’t have his best stuff Friday. “When I don’t have my best, they know how it’s going to be. On the difficult days when I don’t strike out people much, I try to get outs with ground balls and fly balls. My change-up was working.”

There have been numerous times when Freeman has made a backhanded play on a bounced throw look easy, the big first baseman saving a lot of potential errors for infielders. Uggla wasn’t so fortunate with two out in the fifth inning.

The second baseman fielded LaRoche’s routine grounder and bounced a throw that Freeman gloved but couldn’t hang onto. Uggla’s error opened the door that the next batter, Zimmerman, barged through. His three-run homer off Teheran erased a 4-1 Braves lead. Jayson Werth’s two-out single had gotten things started for the Nationals in the inning.

Ramiro Pena is far from a power hitter, but the Nationals could be forgiven if they’re starting to think otherwise of the Braves utility infielder. One day shy of the one-year anniversary of his most memorable home run – a 10th-inning game-winner at Washington – Pena hit another multi-run homer Friday.

Pena’s three-run homer was part of a four-run second inning against Roark, and staked Teheran to a 4-0 lead. Justin Upton hit a leadoff single and Uggla was hit by a pitch before Gattis lined an RBI single up the middle. Pena followed with his homer to the right-field bleachers, his third homer again the Nationals in his 25th career at-bat against them.

Pena has a total of three homers in 391 career at-bats against all other major league teams.

It also gave Pena home runs in consecutive games against the Nationals, since he didn’t play in last weekend’s series in Washington. He tore up his right shoulder two weeks after his homer at Washington last April 12 and had season-ending surgery.

Teheran had one walk and one strikeout, his lowest strikeout total since recording none in two innings at Pittsburgh in his seventh major league start on Sept. 3, 2012. The only other times he struck out fewer than two were in each of his first career starts in May 2011, when he lasted 4 2/3 and four innings.