MIAMI (AP) -- With a score that resembled a football game more than baseball, the San Francisco Giants came out on top with their best offensive performance of the season.
Hunter Pence hit two doubles, a triple and drove in five runs to lead the Giants to a 14-10 victory over the Miami Marlins on Friday night.
''We had a lot of guys getting on base, a lot of action, and we scored enough runs to get the win, so it felt good,'' Pence said.
Hector Sanchez hit a three-run homer, Pablo Sandoval reached base six times with four hits and three RBIs, and Brandon Belt had four hits and scored four runs for the Giants, who set season highs for runs and hits (19), eight of which went for extra bases.
''Everybody was doing something there to contribute,'' manager Bruce Bochy said. ''It's good to see us break out because we needed it.''
Justin Ruggiano homered twice and drove in four runs for Miami. Christian Yelich and Placido Polanco each had three hits.
San Francisco's offense broke loose after averaging 2.73 runs per game since the All-Star break, the second-fewest in the majors.
''I was kind of like, 'What's going on right now?''' Belt said. ''I don't know, but it was a lot of fun. It was kind of one of those things where we knew we had it in us, we were just kind of waiting for it to come out and it did today.''
The Marlins scored their second-most runs since June 2.
''For us to score 10 runs and end up losing the ballgame, it's kind of hard to believe,'' manager Mike Redmond said. ''We haven't had a game like that all year.''
Both starting pitchers struggled.
Chad Gaudin permitted eight runs and 11 hits in four innings for the Giants, while Miami right-hander Nathan Eovaldi (2-3) gave up 11 runs - nine earned - in three innings to tie the franchise record for most runs allowed in a game.
''I think this is the worst I've ever gotten hit,'' Eovaldi said. ''Hopefully this won't happen a lot.''
Sandy Rosario (3-0) pitched two scoreless innings for the win.
''That was huge. You needed someone to stop it and he really won the game for us,'' Bochy said. ''He stopped the momentum and threw great.''
The Giants jumped out to a 4-0 lead in the first keyed by a two-run double from Sandoval.
Pence, who drove in a run in the first on a grounder, delivered a two-run double in the second and Sandoval followed with an RBI single to stretch the lead to 7-0.
''I tried to trust my hands and put the ball in play,'' Sandoval said.
Miami cut the deficit to 7-4 in the third on a two-run double by Logan Morrison and RBI singles by Donovan Solano and Polanco.
Polanco left in the eighth when he was hit in the back of the head by a pitch from Santiago Casilla.
Pence came through again in the fourth with an RBI double followed by a three-run homer by Sanchez to extend the lead to 11-4, ending Eovaldi's night. Gregor Blanco added an RBI single later in the inning.
Despite the large deficit, the Marlins fought back again beginning with a solo homer and a two-run double by Ruggiano, who came off the bench in a double switch, to pull to 12-7. Yelich and Solano followed with RBI singles in the fifth to make it 12-9.
Through five innings, the teams combined for 21 runs and 29 hits as each team batted around twice.
Belt and Pence hit back-to-back RBI triples in the seventh to push the lead to 14-9.
''It's one of those games, both teams are scoring, and we did a great job of adding on,'' Bochy said. ''They scored and we came back. It's hard to stop an offense when they get on a roll and both teams got on a roll, so it was important that we kept adding on.''
Ruggiano hit his second home run of the game in the bottom of the ninth to close the scoring, setting a Marlins Park record for runs in a game.
''That's a football score there,'' Bochy said.
NOTES: Ruggiano homered for the first time at Marlins Park after hitting 12 away from Miami. ... Belt extended his hitting streak to 11 games with a single in the first. ... Former Marlins pitcher Ricky Nolasco also allowed 11 runs on Aug. 17, 2011, at Colorado. ... Miami reliever Arquimedes Caminero made his major league debut in the eighth. ... San Francisco's previous high in runs this season was 10 (done seven times) and hits was 17 (three times). ... The Giants will send RHP Matt Cain (7-8, 4.44 ERA) to the mound on Saturday to face Marlins RHP Henderson Alvarez (2-1, 3.18).