Miami snapped its three-game slide and won for the first time since Cosart allowed one run in 7 2/3 innings at the Angels on Monday.
Donovan Solano belted a home run off Braves starter Aaron Harang and added two RBIs, while Giancarlo Stanton had a run-scoring single.
The Marlins rebounded after losing, 5-2, on Friday night to even their weekend series at Atlanta, and they improved to 66-68 overall. They are 5 1/2 games behind the Cardinals for the second National League Wild Card spot.
Cosart, A.J. Ramos, Mike Dunn and Steve Cishek combined on Miami's 14th shutout of the season.
Going from the Astros to Miami, a team with postseason aspirations, has been a boost for Cosart.
"Some guys really need that adrenaline, and they really thrive in those situations," Miami manager Mike Redmond said. "For him, going from Houston to our team, a team that is young and headed in the right direction, and is fighting for a playoff spot, that energizes guys.
"You kind of see the best from your players in those situations. He's definitely one of those guys who has risen to the occasion. He wants it. He wants to help us make it to the playoffs. Those are the kinds of guys a manager wants on his team."
Since the July 31 trade, Cosart has made five starts for Miami and is 3-1 with a 1.64 ERA. But in his last four outings, he has an ERA of 0.65 (two earned runs in 27 2/3 innings).
The 24-year-old right-hander makes it clear he is motivated by his new beginning on an enthusiastic young team.
"It's a chip on your shoulder, obviously," Cosart said. "I didn't have a contract. I wasn't a high-paid guy. You just play with that extra chip on your shoulder. It would be the icing on the cake if we could somehow get into the playoffs, and I could continue to do well into the playoffs. You just go out there staying motivated every day, and trying to help this team win.
"There is no disrespect to the Astros, but hopefully, I can make them get the bad end of that trade."
Solano, who connected in the first inning, doesn't have many home runs, but he's made the few that he's had count. He has three this season, with the previous two coming off David Price and Adam Wainwright. Miami won both of those games.
Miami padded its lead to two runs with a two-out rally in the third inning. Christian Yelich walked and moved to third on Solano's single to right. Stanton then slapped a run-scoring single to center, snapping an 0-for-12 slump with eight strikeouts. The RBI was the slugger's National League-leading 98th, moving him closer to posting Miami's first 100-RBI season since Dan Uggla had 105 in 2010.
In the fifth inning, Solano came through with a two-out, run-scoring single that scored Yelich, who had doubled.
Miami made it 4-0 in the sixth inning, when Jarrod Saltalamacchia scored on Evan Gattis' passed ball. Saltalamacchia had walked and moved to third on Adeiny Hechavarria's double.
Harang was lifted after 5 2/3 innings and 97 pitches, allowing four runs (three earned) on seven hits.
Through five innings, Cosart was at 59 pitches. His first stressful frame was the sixth, when he had two on and one out before striking out Andrelton Simmons looking with the count full. The threat ended when Freddie Freeman tapped to second.
"That cutter. It's not often you see a guy, especially a starter, who throws that many cutters," Atlanta's Chris Johnson said. "He maybe only threw a handful of two-seamers or four-seamers tonight. He was cutter, curveball. That's a tough pitch against right-handers and left-handers. He was good at it. He was spotting it up. He was working it inside-outside. It's just something we have to get used to, him being in our division now. We have to try to get used to it and work out a plan for the cutter."
The Braves threatened in the eighth, with Cosart allowing singles to Tommy La Stella and B.J. Upton to open the inning. But Ramos, who struck out two, and Dunn were able to work out of a bases-loaded jam.
"I got a little tired there at the end," Cosart said. "That's something I got to work on. I just got to keep moving forward, keep the momentum going."