LaMonte Wade Jr. tied it with a two-out single in a four-run ninth inning and Kris Bryant doubled in the winning run in the 10th in the San Francisco Giants' 5-4 victory over the Arizona Diamondbacks on Thursday.

The Giants (69-40) moved four games ahead of the idle Los Angeles Dodgers in the NL West. They're 12-2 against Arizona, a major league-worst 34-76.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

After managing three hits and no runs against Arizona starter Merrill Kelly over eight innings, the Giants had five hits in the ninth. Wade's single to right on a full count brought in the final two runs against Tyler Clippard.

Bryant started that rally with a double off reliever Taylor Clarke. Alex Dickerson and Brandon Crawford followed with hits, and Clippard came in. He hit Donovan Solano with a pitch and Brandon Belt's single brought in the second run. Clippard retired pinch-hitters Buster Posey and Wilmer Flores before Wade's single tied it.

Tyler Rogers (3-1) pitched a scoreless ninth for the victory. Jake McGee got the last three outs for his 24th save as the San Francisco bullpen worked six innings without giving up a hit.

Arizona's Tyler Gilbert (0-1), in his second major league game, allowed the unearned run with the extra-inning runner to take the loss.

Before the rally, it was all Kelly and Pavin Smith as the Diamondbacks built an early 4-0 lead.

Kelly gave up three hits, walked two and struck out four. He threw 102 pitches and only had one inning with more than one baserunner — the second, when Crawford singled and Belt drew a walk.

The Diamondbacks struck early against Alex Wood. Nick Ahmed doubled to center leading off, moved to third on a flyout and after a pair of walks, Smith lined a hit just to the right of second baseman Solano to score two runs.

Smith, who was out for a week on the COVID-19 list, delivered again in the third following singles by Carson Kelly and Christian Walker. Smith’s single under Solano’s glove brought Kelly home. Jake Hager later walked with the bases loaded for his first major league RBI and a 4-0 Arizona lead.

Wood lasted four innings, throwing 80 pitches. He walked three, hit a batter and struck out five. Because his teammates came back in the ninth, he still has not been charged with a loss since June 1.

CLICK HERE TO GET THE FOX NEWS APP

MOVES

Giants: Belt, sidelined since June 25 with right knee inflammation, was activated Thursday and batted seventh at his familiar first base spot. He was 1 for 3 with a walk.

To make room on the roster, the Giants placed RHP Kevin Gausman on the paternity list. The Giants were carrying only 11 pitchers on Thursday; they used seven of them.

Diamondbacks: With Pavin Smith’s return, veteran OF Josh Reddick was designated for assignment.

"He had solid at-bats for us, but the reality was that the playing time was drying up," manager Torey Lovullo said. "We need to see what some of the younger players can do."

Arizona also activated RHP Riley Smith from the injured list, then optioned him to Triple-A Reno. To clear a spot for Clarke (arm), the Diamondbacks sent RHP J.B. Bukauskas to Reno.

NEXT

Giants: Off to Milwaukee for a weekend series against the NL Central leaders. Logan Webb (5-3, 3.33) goes against Brewers All-Star Corbin Burnes (6-4, 2.46).

Diamondbacks: Caleb Smith (3-8, 5.04) faces fellow lefty Ryan Weathers (4-3, 3.65) as Arizona begins a three-game set at San Diego.