Ed Szczepanski-USA TODAY Sports

Brandon Crawford smacked a two-out, two-run home run off Ian Kennedy in the ninth inning Tuesday night, allowing the San Francisco Giants to steal a 2-1, walk-off win over the visiting Arizona Diamondbacks.

Christian Walker homered and right-hander Merrill Kelly continued his dominance over the Giants with seven shutout innings, but it wasn't enough for the Diamondbacks, who were one strike away from a 1-0 victory before Thairo Estrada tripled with two outs in the ninth.

Crawford swung and missed Kennedy's next delivery, then connected with his 0-1 fastball and sent it over the fence in straightaway center field for his sixth home run of the season.

The walk-off win was the Giants' seventh of the year and second in three days. Estrada ended an 8-7 win over the Pittsburgh Pirates on Sunday with a two-run homer.

The walk-off loss was the Diamondbacks' sixth of the year and their second this season in San Francisco.

John Brebbia (6-1), who pitched a scoreless top of the ninth, was credited with the win. Kennedy (4-6) took the loss.

Walker's homer, his 29th of the season, came leading off the fourth after Giants starter Jakob Junis had allowed just two hits in the first three innings. The homer was his third in the last three games and allowed him to match his career high of 29 set in 2019.

The Giants had just four hits in Kelly's seven innings. Kelly walked two and struck out seven, and he has now allowed just four runs and 14 hits in 28 1/3 innings against San Francisco this season over four games.

Junis appeared to be headed toward a hard-luck loss after allowing just the one run on four hits in seven innings. He struck out seven without issuing a walk.

Jake McCarthy had the only other extra-base hit, a double, for the Diamondbacks, who dropped the series opener 6-1 on Monday night.

The comeback extended the Giants' winning streak to five games.

More must-reads:

TODAY'S BEST
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
Bulls hire former NBA head coach as top assistant
Chiefs move on from young running back
20-year MLB veteran working out, unsure about playing future