PHOENIX -- The battle of the All-Star first basemen went to the one who had the last plate appearance Monday.
Arizona's Paul Goldschmidt trumped Freddie Freeman's homer in the top of the ninth inning with a walk-off game-winning homer leading off the last of the ninth in the Diamondbacks' 9-8 victory over the Atlanta Braves at Chase Field.
Goldschmidt hit an 0-1 pitch from right-hander John Gant (1-3) into the left-field seats for his 19th homer of the season, and his fourth career walk-off homer, when all he was trying to do was get on base.
"Tie game or extra innings, the tendency is to try to hit home runs," Goldschmidt said, "and that just has not worked out for me or other guys. It kind of creeps into the back of your head, you try to do too much and try to hit a home run.
"I think a lot of time it's mental. 'Hey, one swing can change this game.' I didn't want to give in to that thought process. I've had a few at-bats where I felt like I took a little too big of a swing and just got myself out.
"He left a changeup up and just reacted. Fortunate to get it out of there."
Atlanta first baseman Freeman tied the game when he hit a 3-0 pitch from Enrique Burgos (1-1) for his second homer of the game to even the score at 8.
"He is a very good hitter, one of the best in the major leagues," Arizona manager Chip hale said. "Two of the best in the league right here going at it."
Freeman had a two-run homer in the first inning, and he doubled in the second as Atlanta took 5-0 lead.
He drove in three and scored three after missing Sunday's game when he received a cortisone injection in his right middle finger to alleviate what has been season-long discomfort.
"The finger felt good," Freeman said. "Didn't know what to expect today. Decided to be aggressive in my first at-bat. Just looking for a strike (in the ninth inning). I knew he didn't want to walk the leadoff guy. That's why I was going for it 3-0."
Adonis Garcia hit a two-run homer for Atlanta (45-80), which has lost 10 of 12.
Goldschmidt added two singles and a sacrifice fly as the Diamondbacks (52-73) overcame their largest deficit of the season. They overcame a six-run deficit in Atlanta last year. They had lost three of four.
Jean Segura and Michael Bourn each had three hits and scored twice for the Diamondbacks, and Yasmany Tomas hit his 26th homer in a three-run third inning that cut Atlanta's lead to 5-4. Segura leads the NL with 159 hits.
Tomas has 13 homers in his past 22 starts, and he tied a franchise record with homers in four consecutive home games. Nine of his past 16 hits are homers.
Nick Markakis had three hits and an RBI and Ender Inciarte added two hits and two runs for the Braves, who extended their lead to 7-4 with two runs in the fifth inning.
Welington Castillo hit a three-run double to cap a four-run seventh inning as Arizona took an 8-7 lead. Segura, Bourn and Goldschmidt had hits in that inning, and Tomas kept it alive with a two-out walk to load the bases for Castillo.
"I think that was as impressive as his home run," Arizona manager Chip Hale said of Tomas' walk. "When you can draw a walk when a guy is pitching you tough ... he didn't give in as a hitter and swing at a pitcher's pitch. That kept the line moving. He's really matured."
Atlanta right-hander Mike Foltynewicz gave up four runs and nine hits in six innings and was in line to win his third straight decision and fourth in five before the bullpen faltered. He struck out seven and did not walk a batter.
Arizona starter Zack Godley gave up seven runs and nine hits in five innings.
NOTES: Arizona CF A.J. Pollock (elbow) is expected to be activated from the disabled list on Wednesday or Thursday, manager Chip Hale said, if there are no setbacks in his rehab assignment. His two-day rehab assignment ends Wednesday. ... Atlanta SS Dansby Swanson made his fifth career start in the first game of a three-game series. The Diamondbacks made him the first overall pick in the 2015 draft before trading him to Atlanta in a deal for RHP Shelby Miller at the winter meetings.