MIAMI — Alex Gonzalez went 23 games and nearly a month without a home run or even an RBI, then made it count when he finally snapped the drought.

The veteran shortstop homered in the fourth inning Tuesday to account for all the scoring in the Braves’ 1-0 win against the Florida Marlins at Sun Life Stadium. His was the only hit through eight innings for the offensively challenged Braves.

Tommy Hanson (7-4) worked out of a couple of jams in six innings of two-hit ball, and the Braves dealt the Marlins their sixth consecutive loss.

“To get two hits and win that game, is crazy,” said Hanson, who had five walks and six strikeouts, including three walks in the sixth inning. “But I think we played really good defense, and the relievers picked me up going out there for those three innings.”

Mike Stanton grounded into a fielder’s choice to leave the bases loaded in the sixth for the Marlins, whose losing skid reached six games.

The Braves moved past Florida into second place in the National League East and cut Philadelphia’s lead to three games. The win came in Braves manager Fredi Gonzalez’s first game back in South Florida since the Marlins fired him in June 2010.

“One good hit and good pitching,” the manager said. “We’ll take it.”

Martin Prado gave the Braves a scare when he was struck in the left knee by a throw to second base on a two-out steal in the ninth inning. A trainer and Gonzalez went to check on him, but Prado insisted on staying in the game.

“I thought they bumped knees, but the ball hit him,” Gonzalez said. “He’s fine. Obviously we’ll check him tomorrow, but the bone’s got to be sticking out for him not to play tomorrow. ... My only concern was could he run and score on a single in that situation, and he assured me he could.”

It was another night when pitching carried the Braves. The Gonzalez homer was their only hit in six innings against Brad Hand, a 21-year-old left-hander who had not pitched a game above Double-A before Tuesday.

“The big thing is, we won this game,” Alex Gonzalez said. “We didn’t have too many hits, but we won. We know we have a better offense than that. Just get ready for tomorrow and try to wake [up the bats]. We know we can hit.”

Hand had one walk and six strikeouts in his major league debut against a Braves team that has scored three runs or fewer in 12 of its past 20 games.

After Hanson got through six, the Braves turned it over to their workhorse bullpen trio of Eric O’Flaherty, Jonny Venters and Craig Kimbrel, who gave up a two-out walk in the ninth before recording his 18th save.

Hanson trimmed his ERA to 2.59 and improved to 5-1 with a 2.32 ERA in eight career starts against the Marlins, including 2-0 with a 0.43 ERA in his past three.

“It was a big win for us, especially after we lost a series in New York,” Hanson said after the Braves improved to 2-2 on a 10-game trip that will end in Houston after two more against Florida. “To come down and get off on the right foot, this is a big win for us. Hopefully we can keep it going.”

The Braves won despite not getting a second hit until Prado’s two-out single in the ninth. They have a 23-7 record when they score first, compared to 10-21 when they do not. It was only their sixth win in 22 games when they’ve scored two runs or fewer.

Before Tuesday, Gonzalez had batted .281 with over his past 23 games, with 23 singles in 25 hits over that period. The homer was his sixth for the Miami resident, who went deep to beat the team he started with in the late 1990s.

“I’ve got family, friends here,” he said. “This was a big hit for me, and for us.”

Dan Uggla’s first game back in South Florida against his old team provided more of same for the slumping second baseman. He went 0-for-3 to drop his average to .170 and make him 5-for-63 with one RBI in his past 19 games.