Matt Waldron had his best outing of the season and Gavin Sheets and Xander Bogaerts homered to beat the Giants 5-1 Wednesday afternoon in San Francisco.

The game was tied 1-1 the seventh inning, when Ty France delivered a two-out pinch hit triple that scored Fernando Tatis Jr. and Ramon Laureano.

Bogaerts’ seventh homer of the year and second in as many games put the Padres ahead 5-1.

Adrian Morejon pitched scoreless seventh and eighth innings, striking out four. Mason Miller struck out a pair to cement the win.

Craig Stammen went with an opener in the rubber game against the Giants, sending Bradgley Rodriguez out for his first career start. Waldron followed with five innings of one-run ball, striking out seven while allowing two hits and no walks.

His lone misstep came in the fifth, when Rafael Devers hit his first home run in nearly a month to tie the game at 1-1.

Gavin Sheets opened scoring with a solo shot in the fourth, his fifth of the season. Nick Castellanos had two hits in the win.

The Padres take the series over their NL West rivals after dropping consecutive series to the Cubs and White Sox.

San Diego returns home to host the Cardinals beginning Thursday.