WASHINGTON — Dansby Swanson’s first major league home run stayed in the ballpark. It just wasn’t enough to get the Atlanta Braves a victory Tuesday night against the Washington Nationals.

The 2015 overall No. 1 draft pick hit an inside-the-park home run in the second inning, but the Nationals rallied for a 9-7 victory over the last-place Braves. It was Swanson’s first career home run.

“It was one of those things where I thought it was going to be my first triple,” Swanson said. “Then as I kept going, judging by the reaction in the dugout and the crowd, I thought ‘Maybe I’ll get an inside-the-parker.’ I just kept going.”

The Nationals took the lead with a three-run eighth inning. Michael A. Taylor pinch-ran after Braves reliever Jose Ramirez (2-2) walked Ryan Zimmerman. Taylor stole second and, after Danny Espinosa’s walk, scored when an off-balance Tyler Flowers threw pinch-hitter Ben Revere’s bunt attempt well to the left of third baseman Adonis Garcia.

“I knew if I got my hand on it, it had to be quick,” Flowers said. “When I went through it all in my head, I imagined it being a little more accurate in my head before it happened. It’s a do-or-die play. The game is essentially on the line. I tried to be an athlete and it just didn’t work out.”

Trea Turner then hit a two-run single for Washington, which beat Atlanta for the 13th time in 15 meetings this season.

Koda Glover (2-0) retired the only two batters he faced to earn the victory, while Mark Melancon got his 39th save in 42 opportunities.

The Braves built an early lead thanks in part to Swanson’s home run.

Swanson lined a pitch from Gio Gonzalez over Turner and high off the fence in center field, 399 feet away. The ball caromed toward the infield, and Swanson slid home headfirst, easily beating the throw by right fielder Bryce Harper.

“It went farther than I thought it was going to go,” Swanson said. “It was kind of Baseball 101: Hit it and run until it’s caught or until they stop you.”

Swanson was selected by Arizona in the draft, traded to Atlanta in December and made his big league debut Aug. 17. He entered the night hitting.236 with four RBIs in 55 at-bats.

Atlanta’s previous inside-the-park home run was by Wes Helms on Oct. 7, 2001.

The Braves led 4-1 after Freddie Freeman’s RBI single in the third, but Washington blasted starter Williams Perez later that inning. After three consecutive Nationals singles, Anthony Rendon launched an 0-2 pitch to left for his first career grand slam. Zimmerman chased Perez two batters later with a solo homer to cap the five-run inning.

“We just sometimes can’t stay away from that crooked number in one inning,” interim manager Brian Snitker said.

STREAKS CONTINUE

OF Ender Inciarte singled twice to extend his hitting streak to 17 games, two shy of his career high. Freeman pushed his hitting streak to 13 games with a single.

TRAINER’S ROOM

Braves: RHP Matt Wisler (sore side) played catch a day after he missed his scheduled start. Snitker said Wisler would likely need a couple of side sessions before returning to the rotation.

Nationals: Washington recalled INF Wilmer Difo and RHP Lucas Giolito from Triple-A Syracuse. Difo hit .257 with five RBIs in 35 at-bats in earlier stints with the Nationals, while Giolito is 0-1 with a 5.63 ERA in four starts in the majors.

UP NEXT

Braves: RHP Mike Foltynewicz (8-5, 4.31) starts the series finale for Atlanta. Foltynewicz earned a victory in his only previous start this year against Washington, allowing four runs in 5 2/3 innings on Aug. 12.

Nationals: Washington manager Dusty Baker said RHP Stephen Strasburg will start Wednesday. Strasburg (15-4, 3.59) has not pitched since Aug. 17 because of right elbow soreness.