ATLANTA — Jace Peterson’s first walk-off homer couldn’t have come at a better time for the Atlanta Braves.

Peterson hit a 3-2 hanging slider from Shawn Kelley over the right-field fence with two outs in the 10th inning for a 7-6 victory over the Washington Nationals on Sunday.

It was just the second win for the Braves over the Nationals in 13 games this season.

Peterson, playing his first game in center field, made a catch crashing into the fence early in the game and then won it with his seventh homer of the season.

The victory snapped a seven-game losing streak by the Braves, who benefited from the Nationals’ season-high five errors.

Bryce Harper hit a three-run homer in the third inning for the Nationals and Chris Heisey had a two-run shot in the sixth inning, but the Braves scored twice in the eighth to force extra innings.

Matt Kemp led off the tying eighth-inning rally by driving a 1-1 slider from Yusmeiro Petit into the left-field seats for his 25th home run and second with Atlanta.

The Braves then loaded the bases with no outs on a single by Jeff Francoeur, a throwing error by Petit on a sacrifice bunt and an intentional walk before a downpour caused a 64-minute delay.

Blake Treinen kept the Braves from taking the lead. Gordon Beckham hit into a double play on the reliever’s first pitch, although the tying run scored on the play. Dansy Swanson grounded out to end the inning.

Jose Ramirez (1-0) pitched the 10th inning for the Braves to pick up the first victory of his career. Kelly (1-2) was the loser.

Nationals starter Gio Gonzalez, who was bidding for his 100th career victory, allowed six hits and four runs (three earned) in 5 2/3 innings while striking out eight and walking three. He also had the first two-hit game of his career.

Right-hander Joel De La Cruz became the 32nd straight Braves starter not to make it to the seventh inning. He worked 5 2/3 innings and allowed seven hits and six runs while walking two, hitting a batter and striking out four.

Harper’s homer, his 22nd of the season and 16th of his career against the Braves, was a long blast to right field on a first-pitch slider from De La Cruz. It was part of a four-run third inning that would have been bigger if Peterson had not made a catch while crashing into the fence.

The Braves benefited from two errors in the bottom of the inning to cut the Nationals’ lead to 4-3. Nick Markakis’ double drove in two runs.

De La Cruz retired nine straight batters before a one-out walk in the sixth inning, and Heisey followed with his eighth homer, lining a 2-1 sinker into the left-field seats.

NOTES: The Braves activated RHP John Gant, who had been on the disabled list since June 28 with a left oblique strain. He took the roster spot of RHP Tyrell Jenkins, demoted to Triple-A Gwinnett after giving up eight runs in the fourth inning Saturday. … LF Jayson Werth and 3B Anthony Rendon got a day off for the Nationals. … 1B Freddie Freeman and CF Ender Inciarte were out of the Braves’ lineup for rests. RF Nick Markaksis played 1B for the first time since 2014 with Baltimore and just sixth time of his career. … RHP Stephen Strasburg (15-4, 3.59 ERA) will try to bounce back from three consecutive rough starts as the Nationals open a two-game interleague series at Baltimore on Monday. … The Braves begin a road trip at Arizona, with Mike Foltynewicz (6-5, 4.45 ERA) drawing Monday’s start.