SAN FRANCISCO (AP) -- Justin Bour hit his 20th home run, Marcell Ozuna drove in two runs and the Miami Marlins held on to beat the San Francisco Giants 5-4 on Saturday night.
Christian Yelich and J.T. Realmuto added two hits apiece and All-Star Giancarlo Stanton doubled and scored while helping Chris O'Grady to a victory in his major league debut for the Marlins.
San Francisco scored a run in the ninth off closer A.J. Ramos and had runners at the corners with two outs before Hunter Pence struck out looking to end the game.
Bour homered off Giants starter Jeff Samardzija leading off the fourth, giving the Marlins three players with 20 or more home runs before the All-Star break with Stanton (24) and Ozuna (23). Cincinnati is the only other team in the majors to have three players with 20 or more.
Brandon Belt doubled twice and scored two runs, and Brandon Crawford had two RBIs for the Giants. San Francisco has lost two straight since returning from its best road trip of the season.
Three months after being released outright by the Los Angeles Angels' Double-A team before signing a minor league contract with Miami in May, O'Grady (1-0) celebrated his debut with a workman-like effort. The rookie pitcher allowed three runs on five hits over 5 1/3 innings with four strikeouts and two walks.
Five relievers completed the seven-hitter. Ramos retired three batters for his 16th save.
Samardzija (4-10) allowed four runs in seven innings. He struck out five and walked one while losing to the Marlins for the second time in nine career starts.
BONDS FIRST PITCH
Home run king Barry Bonds threw out the ceremonial first pitch. The 52-year-old former slugger had been honored earlier in the day by the Giants with a plaque on the team's Wall of Fame. Bonds' son, Nikolai, caught the first pitch as players from both teams watched and applauded.
Giants: OF Austin Slater was placed on the 10-day disabled list because of a strained right groin. The team initially thought Slater hurt his hip trying to beat out an infield grounder Friday night and is awaiting results from an MRI test. Mac Williamson was called up from Triple-A Sacramento to replace Slater.
Giants RHP Johnny Cueto (6-7) will start the series finale at AT&T Park on Sunday afternoon in place of Matt Cain. Miami will counter RHP Jose Urena (7-3, 3.43). Cain was penciled in to start, but manager Bruce Bochy made the change because he didn't want Cueto -- scratched from his last start due to an ear infection -- to wait until after the All-Star break to pitch again.