Anderson homered twice to reach 20 for the season to lead the Marlins to a 9-2 victory over the Atlanta Braves on Thursday night.
"It's good to see when you get those personal accomplishments but at the end of the day it's nice see us playing better ball," Anderson said. "I'm just trying to get better pitches to hit. I still have a lot of room to develop."
Elieser Hernandez pitched six shutout innings as the Marlins returned from a six-game road losing streak and beat the NL East-leading Braves at home for the first time this season after six previous losses. Hernandez (2-4) allowed two hits, struck out seven and walked two. The right-hander retired 11 consecutive batters before Ronald Acuna's leadoff single in the sixth.
"You don't want what happened on the road to continue," Miami manager Don Mattingly said. "Guys walked out of here with a good feeling."
Hernandez also got his first career hit with a single in the fifth.
"I always have worked for that and I knew that day was going to come," Hernandez said through a translator.
The Marlins chased Atlanta starter Dallas Keuchel with a five-run fourth capped by Anderson's second home run for an 8-0 lead. Anderson's drive landed in the walkway above the left-center wall for his first career multi-homer game.
Anderson is hitting .400 with four home runs and six RBI in his last seven games.
Miami also got run-scoring singles from Berti and Jorge Alfaro, and Castro's RBI double in the inning.
Keuchel (3-5) allowed eight runs and 10 hits in 3 2/3 innings, his shortest outing since joining the Braves on June 10.
"Today it just seemed like they took some advantage of some hitters' counts whether it was early or I was behind with some rolling cutters," Keuchel said. "There wasn't really many things to enjoy about tonight."
Berti's RBI single off Atlanta reliever Jeremy Walker in the fifth put Miami ahead 9-0.
Castro hit a two-run homer and Anderson followed with a solo blast to give the Marlins a 3-0 lead in the first. Castro's shot was his 10th, giving him double-figure home runs in nine consecutive seasons.
Acuna hit his 30th homer, a solo blast off Miami reliever Tayron Guerrero in the eighth.
"I'm trying not to give away at-bats and I'm trying not to give away pitches," Acuna said through a translator. "It doesn't matter if it is a 15-pitch at-bat, I'm going to be aggressive on every single pitch. That's just the mentality I take going into every at-bat."
Alfaro kept the Braves from an early lead when he tagged Ozzie Albies out at home in the first. A pitch from Hernandez got past Alfaro and bounced off the backstop. Alfaro retrieved the ball, ran toward the plate and beat Albies, who tried to score from third after his one-out triple.
"He flipped the game right there, instead of us getting behind quick and didn't have to battle back," Mattingly said.
Atlanta recalled Walker from Triple-A Gwinnett and placed outfielder Austin Riley on the injured list. Walker relieved Keuchel and pitched 3 1/3 innings.
Miami re-instated reliever Austin Brace from the injured list and optioned reliever Tyler Kinley to Triple-A New Orleans.
Braves: Riley (right knee) will be examined by orthopedic surgeon Dr. James Andrews on Monday to determine if he will require surgery. Results of an MRI confirmed Riley sustained a partial tear of a ligament in a weight room workout earlier in the week.
Marlins: IF Miguel Rojas (strained right hamstring) underwent an MRI Thursday. Barring any setback, manager Don Mattingly expects Rojas to return before the end of the season.
Braves: RHP Julio Teheran (6-7, 3.46) will make his fourth start against Miami this season on Friday. Teheran has pitched 18 scoreless innings and allowed nine hits in his three outings against the Marlins in 2019.
Marlins: LHP Caleb Smith (7-5, 3.35) is the only Marlins starting pitcher with a road win over the Braves in 2019. Smith got the decision as he allowed three earned runs through six innings in a 5-4 victory at Atlanta July 6.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Fiers doesn't want to talk about the past
Athletics pitcher Mike Fiers tells reporters that he's not talking about his role as a whistleblower and is hoping to move forward.
Source: Ryan Zimmerman agrees to 1-year deal with Nationals
Ryan Zimmerman, the first draft pick of the Washington Nationals after the team relocated from Montreal, has agreed on a one-year contract to remain with the team, as first reported by The Washington Post.
Sources: Rockies, Trevor Story agree to 2-year, $27.5M deal
The deal buys out the final two years of arbitration for Trevor Story, who will reach free agency at 29 in 2021-22.
Athletics' Mike Fiers declines to discuss whistleblower role
A's pitcher Mike Fiers said he didn't want his role as a whistleblower to be a distraction to his team, reiterating several times that he's "moving forward" and would not to discuss the sign-stealing scandal.
Royals' Salvador Perez becomes U.S. citizen at team's fan event
Royals catcher Salvador Perez took his oath of citizenship on Friday during the team's annual FanFest, the completion of a five-year process that he described as long and difficult but well worth it.
New manager Luis Rojas promises Mets success
Luis Rojas, who just 11 days earlier was prepping for spring training as a relatively anonymous quality control coach, said Friday at his introductory news conference that he will lead the Mets to success.