PHOENIX -- The series between National League playoff hopefuls Atlanta and Arizona has been a wild ride, and Saturday night's ending might have topped them all.
"He just gave every last bit of energy he had and obviously won the game for us," Braves manager Brian Snitker said.
In the bottom of the inning, with runners at second and third, A.J. Pollock grounded a two-out single up the middle. Steven Souza Jr. scored from third, but Ahmed tried to come around from second and was thrown out by Swanson to end the game.
"A.J. hit the ball and I was going hard and T.P. (third base coach Tony Perezchica) was waving me and it was close," Ahmed said. "I didn't get there."
Swanson said he figured Ahmed would try to score because he would have done the same thing.
"That is just kind of how I would play it offensively. He is scoring no matter what," Swanson said. "I don't think anyone really anticipated that I would be able to catch it and be able to make a throw like that. Honestly, it was the right play on both sides."
Diamondbacks manager Torey Lovullo said he didn't have "a perfect snapshot" of the play but thought it might have been better to hold up at third and give the next batter a chance.
"I feel like there's certain times when you take a little bit of risk and there's other times you don't," he said. "That may not have been the best time to take that type of risk."
The victory boosted Atlanta's lead in the NL East to 3 1/2 games over Philadelphia. Arizona fell 2 1/2 games behind first-place Colorado in the NL West.
Neither team led by more than one run until the 10th.
Souza robbed Kurt Suzuki of at least a double with a leaping grab at the right-field fence, but Inciarte followed with a triple that made it 5-3.
Chad Sabotka (1-0) got the final out in the ninth for his first major league win.
With some difficulty, A.J. Minter picked up his 13th save in 15 tries.
Both teams threatened in the ninth. Swanson tripled off Yoshihisa Hirano with one out but was stranded when pinch-hitter Lucas Duda struck out and, after Ronald Acuna Jr. was intentionally walked, Johan Camargo grounded out.
Arizona, with the help of a throwing error by Camargo at third, loaded the bases with two outs in the bottom of the ninth before Daniel Descalso lined out to center.
Suzuki put the Braves up 3-2 with a two-out solo home run off Jake Diekman in the eighth, but Arizona answered in its half of the inning.
There were four errors in the first two innings, three by Arizona, resulting in a 2-2 deadlock.
Acuna doubled on the game's first pitch and scored when Peralta bobbled Camargo's single to left field. Markakis' sacrifice fly made it 2-0.
The Diamondbacks got an unearned run in the first when Pollock came home from first on Goldschmidt's foul pop to the railing beyond first base. Freeman's throw home came in plenty of time, but Suzuki dropped it.
Arizona tied it 2-all in the second when pitcher Clay Buchholz's two-out double to left-center scored Souza from first. It was the first RBI and extra-base hit in 45 career at-bats for Buchholz.
The Diamondbacks, one of the best defensive teams in baseball, committed four errors.
"The errors we made today weren't typical of what we do here every single day," Lovullo said, "so I just think at times we try to make things happen and we force things and maybe press a play or two and will it to happen, and it doesn't happen."
Braves: RHPs Jose Ramirez and Arodys Vizcaino made rehab appearances for Class A Rome in a playoff game Friday. Ramirez allowed four runs and four hits while getting just one out. Vizcaino tossed a scoreless ninth in a 6-0 loss to Lexington that eliminated Rome.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports
Adeiny Hechavarria agrees to minor league deal with Mets, per reports
Veteran shortstop Adeiny Hechavarria and the Mets have agreed to a minor league contract with an invitation to spring training, according to multiple reports.
Rob Manfred addresses pitch clocks coming to springs training, slow free-agent market
Aiming to speed up the pace of play in baseball, Major League Baseball commissioner Rob Manfred says the league will begin implementing pitch clocks in spring training games.
Manfred: MLB could use pitch clock on Opening Day
Rob Manfred explains MLB's decision to test a pitch clock in spring training and discusses the fractured relationship between the league and MLBPA.
Third baseman Mike Moustakas returning to Brewers
Free-agent third baseman Mike Moustakas is returning to the Brewers on a one-year contract, a source confirmed to ESPN.
Pujols: 'My goal is to be ready for March 29th'
Albert Pujols says he knows exactly what he needs to do to be healthy and help the Angels win a championship.
Albert Pujols, Shohei Ohtani eyeing return for Opening Day
Despite being in different stages of both their careers and their respective rehabs, Albert Pujols and Shohei Ohtani are both eyeing a return to the Los Angeles Angels' starting lineup by Opening Day.