Ortiz went deep in the first inning and Shoppach followed with his blast in the second, giving the Red Sox a 4-2 lead.
After Logan Morrison's two-run double in the fifth produced a 5-5 tie, the Red Sox went ahead to stay in the bottom of the fifth when Mike Aviles doubled, went to third on Dustin Pedroia's bunt and came home on Gonzalez's sacrifice fly.
Clay Buchholz (8-2) won his fourth straight start despite getting tagged for five runs on nine hits over six innings.
Alfredo Aceves closed out the win with his 17th save as the Red Sox took the opener of a three-game series.
Marlins starter Mark Buehrle (5-8) was pounded for six runs on seven hits in a five-inning performance.
Morrison drove in all five Miami runs with a two-run homer and a pair of run-scoring doubles.