Sandy Rosario, who suffered a bruised sternum when a liner hit him in the chest Thursday, pitched two scoreless innings of relief to earn the win in Friday's slugfest.
Giants manager Bruce Bochy said Rosario's scoreless relief outing made the difference in what was a back-and-forth offensive marathon.
"A couple of guys asked that after the game: 'Did we win?'" Bochy said. "We don't do anything easy. It's not in our nature."
Brandon Belt added: "It's like, 'What's going on right now?' I don't know, but it was a lot of fun."
The Giants snapped a streak of 27 straight games with three or fewer extra-base hits. They tallied four doubles, three triples and a home run.
Hector Sanchez homered for a second straight game and was one of five Giants to notch an extra-base hit. San Francisco finished 10-for-20 with runners in scoring position, a marked improvement over the club's .248 clip in those situations entering Friday.
Hunter Pence drove in five runs. Pablo Sandoval and Sanchez knocked in three each. The Giants also got RBIs from Gregor Blanco and Belt, who extended his hitting streak to 11 games and fell a home run short of the cycle on a 4-for-6 night.
"It's exciting to see the offense respond to all the runs," Sandoval said. "We give four runs. We answer back. It's one of the best days I've seen from the offense."
Bochy added: "It's good to see us break out. We needed it."
Eovaldi gave up 11 runs (nine earned) on 12 hits with three strikeouts in three-plus innings. The outing made his ERA jump from 2.86 to 3.96.
"Obviously, everything they hit, they hit hard," Marlins manager Mike Redmond said. "They laid off some of his breaking balls and squared up some of his fastballs."
Redmond and pitching coach Chuck Hernandez discussed during the game the possibility of the Giants detecting something from the 22-year-old.
"It looked like they knew what was coming," Redmond said. "We'll have to check the video and see if maybe he wasn't tipping his pitches or something. Tonight, they were on everything."
Miami had a chance to rally all the way back from an eight-run deficit in the bottom of the fifth but after the Fish plated four runs, Giancarlo Stanton, Logan Morrison and Placido Polanco went down in order with two runners on base.
The Marlin who helped make the comeback possible was Justin Ruggiano, who went 3-for-4 with two homers, three runs scored and four RBIs. Ruggiano also notched a two-homer game against the Giants on June 23.
Ruggiano is batting .353 (6-for-17) with four home runs, seven RBIs and six runs against San Francisco this season.
The Giants' banner night was not free of some assistance from the Marlins' defense.
With the bases loaded and no outs in the first, Miami shortstop Adeiny Hechavarria botched a potential double-play grounder off the bat of Pence to plate two runs. Sandoval followed with a two-run double to make the lead 4-0.
One inning later, Morrison misjudged a hop on another potential double-play grounder. Pence and Sandoval followed with RBI hits to up the advantage to 7-0.
After tossing a scoreless third, Eovaldi continued to unravel in the fourth. He gave up four straight hits to begin the frame. The fourth was a three-run homer by Sanchez, who increased San Francisco's lead to 11-4.
After a homerless drought of 56 consecutive at-bats dating back to September 2012, Sanchez has left the yard in back-to-back contests.
"That's a big home run," Bochy said. "They're back in the game at that point, and he helped pack on there, which is so important in a game like this. That's a football score there."
Eovaldi has seen much better days than his disastrous outing Friday night. So has Giants starting pitcher Chad Gaudin.
He took full advantage of the monstrous lead San Francisco's offense gave him, surrendering eight runs on 11 hits -- both season-worst marks -- in four-plus innings.
"I didn't feel great out there today," Gaudin said. "Got behind and just lost control. We won the game, though. So, that's big. That's what matters."
Gaudin endured a rough night, giving up two hits or more in the first, third, fourth and fifth innings. The four runs he surrendered in the third are the most he has given up in a single inning this season.
The right-hander capped his bad night by loading the bases with the first three batters he faced in the fifth. Jose Mijares came on in relief and could not keep the inherited runners from scoring, letting four runs cross the plate.
"I was doing all I could to try to get him through it," Bochy said. "But I probably let him face one hitter too many."
Stanton, Morrison and Polanco each came to the plate representing the tying run, but Mijares retired the first two on swinging strikeouts and got Polanco out on a groundout to the mound.