It was the Florida's third consecutive victory and San Francisco's third straight defeat. The Marlins had not won three straight games since a four-game streak from July 19-22.
After Barry Bonds staked San Francisco to a 1-0 lead in the first with a broken-bat home run -- his 34th of the season and 601st of his career -- the Marlins produced four runs against Jensen (10-8) in the bottom of the frame to take the lead for good.
Andy Fox drew a one-out walk and advanced to third on Kevin Millar's single. After Preston Wilson struck out, Fox scored when Giants first baseman J.T. Snow dropped a throw from second baseman Jeff Kent with Millar caught in a rundown.
After Derrek Lee walked, Encarnacion gave Florida a 3-1 lead with a double to left field that brought in Millar and Lee. Mike Lowell handed Marlins starter Josh Beckett a three-run cushion with a single that drove in Encarnacion.
San Francisco got within 4-3 on Jeff Kent's two-run single in the third, but Millar led off the bottom of the inning with a home run -- his second in as many games -- and Johnson added a two-run double to deep right-center field to cap the scoring.
Beckett (5-6) allowed three runs, four walks and five hits in five innings, but improved to 2-0 against San Francisco this season and snapped a personal two-game losing streak.
Bonds' second of three walks on the night moved him past Joe Morgan for fourth on the all-time list with 1,866.