SAN DIEGO — Matt Chapman's two-run home run in the seventh inning proved to be the difference as the San Francisco Giants defeated the San Diego Padres 4-3 at Petco Park on Wednesday evening, delivering a crucial road victory in what is shaping up to be a fiercely contested NL West division race.

Chapman, who has been one of San Francisco's most reliable offensive contributors this season, turned on a 1-1 fastball from Padres reliever Jeremiah Estrada and drove it deep into the left-field seats to give the Giants a 4-2 lead they would not relinquish. The home run was his eighth of the young season and came at a moment when the Padres appeared poised to hold on for a win after starter Dylan Cease had kept San Francisco's lineup largely in check through six innings.

The Giants' bullpen held firm in the final two innings, with closer Ryan Walker recording a clean ninth to seal the result despite a Padres rally that produced a run in the bottom of the frame, cutting the deficit to one before Walker retired the final batter on a ground ball to third.

San Francisco starter Kyle Harrison pitched five and two-thirds innings, allowing two earned runs on five hits while striking out six. Manager Bob Melvin praised Harrison's composure after the game, noting that his ability to limit damage in the third inning — when the Padres loaded the bases with one out — was pivotal in keeping the Giants within striking distance.

The win moves San Francisco to within half a game of the Padres in the NL West standings heading into the final game of the three-game series. For San Diego, the loss is a frustrating step back following a strong April that had raised expectations around Petco Park. The two clubs will meet again Thursday in the series finale, with both managers expected to deploy key bullpen arms given the divisional stakes.