The Dodgers acquired the four-time all-star first baseman along with pitcher Josh Beckett, injured four-time all-star outfielder Carl Crawford and utility infielder Nick Punto in a blockbuster deal announced earlier in the day.
Los Angeles sent first baseman James Loney and four minor-league prospects to Boston in exchange.
After spotting the Marlins a 1-0 lead in the top of the first inning, Mark Ellis led off the bottom of the frame with a double against Josh Johnson (7-11) and Luis Cruz tied the score with a run-scoring two-bagger.
Matt Kemp (3-for-5) then singled, bringing up Gonzalez, who smacked a pitch just fair down the right-field line for a three-run shot.
Andre Ethier went 4-for-4 with a solo clout and Ellis finished with three hits for second-place Los Angeles, which clinched its three-game series and pulled to within two games of National League West-leading San Francisco with the victory.
Clayton Kershaw (12-7) struck out eight over eight innings to earn his fifth win in six starts. The left-hander allowed two runs on three hits and two walks.
Giancarlo Stanton smacked a solo homer for the Marlins.
Selena Gomez drops F-bomb, walks off stage during Jingle Ball performance
Trader Joe's: Car crashes into Long Island store, injuring 11