Robbie Ray struck out nine batters over five innings and Matt Chapman hit a two-run homer in the fourth inning to help the San Francisco Giants to an 8-2 win over the Cincinnati Reds.