AP photo by John Bazemore / The Atlanta Braves' Ronald Acuna Jr. flips the bat over his shoulder after hitting a home run in the ninth inning to lift his team to a 5-4 home win over the New York Mets on Wednesday night.

ATLANTA — Ronald Acuña Jr. couldn't have asked for a better moment to end his slump at the plate — just in time to halt the Atlanta Braves' home losing streak.

Acuña homered on the first pitch in the bottom of the ninth inning as the Braves beat the New York Mets 5-4 on Wednesday night after blowing an early two-run lead.

Acuña's plan was to end the game in the ninth.

"To be honest, every time one of those situations comes up, I tell everybody or I tell whoever is listening that I'm going to end it, it's over," Acuña, who is from Venezuela, said through a translator.

The homer ended an 0-for-13 drought for Acuña, though he also had two walks before his ninth-inning drive.

Acuña drilled the first pitch he saw from Jacob Barnes (1-1) to center field for his National League-leading 13th homer.

"As soon as I hit it, I knew it was out," Acuña said. "I turned and told everybody, `It's over! It's over!'"

Barnes had two strikeouts in the eighth before returning for a very brief ninth. He feared the worst when Acuña took a big swing.

"When he hit it, I knew there was a chance," Barnes said. "I wasn't sure it was out or not."

The Mets were denied a sweep of the three-game series between the NL East Division rivals. Atlanta snapped a five-game losing streak in home games after dropping a season-worst four games under .500 overall.

"If there was ever a timely win, this was probably it," Braves manager Brian Snitker said.

Pinch-hitter Tomás Nido gave New York a 4-3 lead with a two-run single in the seventh.

The Braves pulled even in the eighth. Aaron Loup gave up three hits, including a run-scoring single by William Contreras, without getting an out. Dansby Swanson was caught stealing at third base on a strong throw by catcher James McCann for the second out of the inning.

The Mets wasted a scoring opportunity in the ninth. Cameron Maybin struck out but reached first on a wild pitch from Will Smith (1-4). Maybin, making his Mets debut after being acquired from the Chicago Cubs on Tuesday, stole second and moved to third on another wild pitch before McCann and José Peraza popped out to end the inning.

The Mets trailed 3-1 before Braves left-hander A.J. Minter's throwing error set the stage for three unearned runs — all with two outs — in the seventh. Minter's wild throw to first base after fielding Dominic Smith's weak grounder in front of the mound set up the outburst.

After Minter walked McCann, Peraza's double drove in Smith. Nido's bloop single to shallow center off Luke Jackson drove in two runs.

Charlie Morton left the game with a 3-1 lead after allowing only two hits in six innings. The Atlanta right-hander had eight strikeouts and no walks, and he hit a run-scoring single in the Braves' three-run fifth.

New York starter David Peterson gave up three runs in 4 2/3 innings.

Jonathan Villar's leadoff homer in the fourth gave the Mets a 1-0 lead.

Atlanta's Guillermo Heredia had an RBI single in the fifth.

On the injury front, Atlanta left-handed pitcher Grant Dayton (thigh inflammation) was activated from the 10-day injured list.

Also, Tucker Davidson was optioned to Triple-A Gwinnett after allowing three runs in six innings Tuesday night in his 2021 debut. Snitker said Davidson "will be in the mix" for spot starts as right-hander Huascar Ynoa (broken right hand) is expected to miss two months.

The Braves also acquired catcher Kevan Smith from the Tampa Bay Rays for cash. Smith, 32, was designated for assignment by the Rays on Sunday after hitting 1-for-4 in three games this season. Braves catcher Jeff Mathis was designated for assignment. Mathis, 38, was 0-for-9 with five strikeouts in three games.