Ed Szczepanski-USA TODAY Sports

Blake Sabol bombed a two-run, walk-off home run to straight-away center field with two outs and two strikes in the bottom of the ninth inning Tuesday night, allowing the host San Francisco to counter a late St. Louis Cardinals rally and pull off a 5-4 victory.

After Paul Goldschmidt had broken a 2-2 tie in the top of the eighth with a two-run single as part of a three-run uprising, the Giants got a break in the last of the ninth when Tommy Edman misplayed Joc Pederson's inning-opening grounder for an error.

Mike Yastrzemski followed with an RBI double to get San Francisco within 4-3, before Cardinals closer Ryan Helsley (0-2), seeking his fourth save of the season, got Thairo Estrada to pop up and struck out Brandon Crawford.

He then got Sabol down 1-2 on the count before the rookie crushed his fourth homer to give the Giants a fourth straight win.

Sean Hjelle (1-0), who pitched a scoreless top of the ninth with the Giants trailing 4-2, was credited with the win, the second of his major league career.

After five Giants pitchers had limited the Cardinals to one run and four hits through seven innings, the Cardinals, down 2-1, finally got their offense in gear when Dylan Carlson and Paul DeJong led off the eighth with singles.

Tyler O'Neill got St. Louis even with an RBI double to right field.

With first base open, Giants manager Gabe Kapler chose to bring in closer Camilo Doval, bring the infield in and pitch to Goldschmidt, who lined a shot that short-hopped shortstop Crawford and deflected into left-center field, allowing two runs to score.

Cardinals starter Jake Woodford worked 5 1/3 effective innings, allowing two runs and five hits, He walked one and struck out four.

The Giants' scoring against Woodford began in the second when consecutive errors by Cardinals catcher Willson Contreras and center fielder Carlson on a successful Estrada steal of second allowed the baserunner to circle the bases

Edman's fourth homer of the season, a solo shot, got St. Louis even in the third, before Yastrzemski went deep for the fifth time this season in the fourth, putting the Giants up 2-1.

Yastrzemski finished with two hits, two RBIs and scored twice, while Sabol had a pair of hits for the Giants, who got four outs from opener John Brebbia to begin a parade of eight pitchers to the mound.

Goldschmidt, Contreras and Carlson had two hits apiece for the Cardinals, who lost for the fourth time in five games on their Western trip.

More must-reads:

TODAY'S BEST
Phil Foden lifts Manchester City to fourth consecutive English Premier League title
Dodgers add recently acquired left-hander to active roster
Report: 2023 No. 7 pick expected to terminate KHL contract, join Flyers
Mavericks advance to Western Conference Finals aided by controversial call late
Connor McDavid, Oilers hammer Canucks to force Game 7
Tyson Fury-Oleksandr Usyk epic increases excitement for potential rematch
Seize the Grey wins in muddy Preakness
Even Mike Budenholzer admits the Suns need a point guard
Watch: Juan Soto's first multi-homer game as a Yankee
Xander Schauffele, Collin Morikawa lead at PGA Championship
Knicks could get major boost for Game 7 showdown with Pacers
Giants All-Star pitcher suffers setback in recovery from injury
Panthers star named winner of 2024 Selke Trophy
WNBA to investigate $100,000 sponsorship deals for Aces players
Tiger Woods blames one big factor for missing the cut at PGA Championship
'Ain't good enough': Draymond Green claims Celtics must 'win it all' or it's a 'failure'
Blue Jays GM wants struggling club to feel 'massive sense of urgency'
Raptors expected to flip former NBA champion during the offseason
MLB insider reveals Mets' massive extension offer that Pete Alonso turned down
Celtics legend provides update after gruesome finger injury

Want more sports news?

Join the hundreds of thousands of fans who start their day with Yardbarker's Morning Bark, the best newsletter in sports.