SAN FRANCISCO -- Miami manager Mike Redmond got immediate results from his decision to put Justin Ruggiano in the leadoff spot.
Ruggiano started the game with a home run in his third career start in the leadoff spot and added a two-run shot in the ninth that broke it open for the Marlins, who beat the Giants 7-2 Sunday for their 10th win in their last 11 games in San Francisco.
"This guy's got a lot of power," Redmond said. "We talked about our offense and trying to get guys in situations. We just led him off in hopes he'd put together some good at-bats and it happened, he hit a couple of big home runs. It was great. He had a great day and was a huge part of the win today."
Nathan Eovaldi (1-0) held the Giants in check into the seventh inning and Marcell Ozuna hit an RBI double and solo homer as the Marlins bested Matt Cain (5-4) and a struggling San Francisco bullpen to wrap up their first winning road trip of the season.
The Marlins went 4-3 in Arizona and San Francisco after taking two of three at home against St. Louis as they try to put a rough 16-44 start to the season in the past.
"Awesome road trip," Ruggiano said. "We played some tough teams. To come out with a winning record, first time this year, you can see things turn around a little bit. It's exciting to come to the ballpark. We're having fun."
The defending World Series champion Giants dropped three of four at home to the team with the worst record in the National League, scoring just eight runs in the four games.
The Giants went 3-4 on the homestand that started with three games against San Diego, marking their first losing homestand since going 3-7 from July 23-Aug. 2 last summer. San Fracisco had won or split the last 10 homestands.
"You can try to make excuses but really we didn't get the job done," Cain said. "We didn't get some guys in when we needed to and we didn't throw the ball like we needed to. We had some games where we had the lead and we didn't finish it off. You have to kind of just say it's over with and move on now."
The Giants did end a 90-inning home run drought when Hunter Pence led off the seventh against Eovaldi with a drive over the left field fence for his 12th of the season to cut Miami's led to 3-2. It was San Francisco's first homer since a leadoff shot by Gregor Blanco on June 14 in Atlanta.
The eight homerless games coincided with an injury to third baseman Pablo Sandoval, who has been out since June 8 with a left foot strain. Sandoval homered the past two days on a rehab assignment with Class A San Jose and will be activated Monday for the series opener in Los Angeles.
"We need a lift right now," manager Bruce Bochy said. "He's a big bat, presence in the lineup. Hopefully he'll take a little pressure off the other guys trying to do too much. Any time you're missing a guy that's hitting in the heart of the order it does make it a little tougher. Hopefully he will spark this lineup."
But Sandoval could only watch against Eovaldi and the Marlins.
Eovaldi allowed just two hits in the first five innings -- a line drive that went in and out of the glove of sliding right fielder Giancarlo Stanton in the first inning and an infield hit between the pitcher's mound and first base by Blanco in the fourth.
Eovaldi was finally touched for a run in the sixth when pinch-hitter Tony Abreu tripled and scored on a groundout by Marco Scutaro. Eovaldi's day ended when he walked Brandon Belt following Pence's homer in the seventh. He allowed two runs and four hits in six-plus innings.
Ryan Webb preserved the lead when he got pinch-hitter Joaquin Arias to hit into a 1-6-3 double play with runners on first and third to end the seventh.
"It's really just a reaction play," Webb said. "As soon as I caught it, I just made sure I had the grip on it. Thankfully we were able to turn it."
Chad Qualls pitched a scoreless eighth with help. Scutaro made the second out at second base when he tried to advance after Stanton threw to third following a single.
The Marlins broke the game open with a four-run ninth against Jean Machi that featured homers by Ozuna and Ruggiano. It was Ruggiano's second career multihomer game.
Cain pitched fairly well after the leadoff homer by Ruggiano on the second pitch of the game. Cain struck out eight batters and walked none in six innings.
The Marlins scored single runs in the fourth on an RBI double by Ozuna and sixth when first baseman Belt couldn't handle a hot shot by Logan Morrison for a run-scoring error that made it 3-0.
San Francisco optioned INF Nick Noonan to Triple-A Fresno after the game to make room for Sandoval. ... The Giants are uncertain whether RHP Chad Gaudin will be able to start Tuesday in Los Angeles after he took a line drive off his pitching elbow in his last start. ... Madison Bumgarner (7-4) will start the series opener against the Dodgers versus Hyun-Jin Ryu (6-3). ... The Marlins are off Monday before beginning a two-game home series Tuesday against Minnesota.