SAN FRANCISCO — With tremendous range, an elite throwing arm and excellent defensive instincts, Cody Bellinger is one of baseball’s best defensive center fielders.

Hampered by a hamstring injury that kept him out of Sunday’s lineup, the Dodgers wanted to lighten Bellinger’s workload and had him make his first start of the season at first base on Tuesday at Oracle Park against the Giants.

The decision paid off…for the Giants.

During a chaotic eighth inning sequence, Bellinger attempted to catch Buster Posey leaning away from third base and wound up throwing a missile high off the netting along the third base line to send home the deciding run in a 2-1 Giants victory.

After Dodgers right-hander Blake Treinen walked the first two hitters he faced in the eighth inning, first baseman Darin Ruf bounced a potential double play ball up the middle. Los Angeles second baseman Max Muncy attempted to tag Giants right fielder Mike Yastrzemski in between first and second base, but Yastrzemski retreated to the first base bag, forcing Muncy to throw over to Bellinger at first to retire Ruf.

“I thought it was a smart base running play by Yaz,” manager Gabe Kapler said. “Obviously he doesn’t want to run into an out and set up an easy double play. I think what you want to do there is give your team every chance to score a run.”

Price & Product Availability Tracker

Discover where products are available & compare prices

Bellinger likely could have doubled up Yastrzemski after getting the force at first, but instead of firing onto second base, he pump faked and wound up to get the lead runner, Posey, who had taken a wide turn around third base.

The throw looked exactly like one Bellinger would unleash from the outfield in an effort to retire a runner trying to score at home plate. And for the Dodgers, that turned into a huge problem.

“That was cool,” starter Logan Webb said. “We were all yelling and high-fiving and stuff and happy he that he threw the ball the way he did and we were able to score.”

The catastrophic throwing error allowed Posey to score the go-ahead run and gave the Giants the edge they needed to win their third consecutive game against their division rivals.

“I was really just trying to be in a position there rounding the bag that if it looked like an opportunity to go, I felt like I was far enough down,” Posey explained. “I might have gotten too far down, because I don’t know if the throw had been there, it probably would have been pretty close.”

After closer Jake McGee finished off the Dodgers in the ninth, the Giants extended their lead in the National League West to 3.0 games, guaranteeing the club will hit the trade deadline in first place.

McGee’s 21st save of the season came in a 1-2-3 ninth inning that followed a tense eighth inning for right-hander Tyler Rogers. After a Chris Taylor double put a pair of Los Angeles runners in scoring position with one out, Kapler came out to the mound and talked with Rogers and Posey about how to approach Muncy, who has crushed the Giants this season.

After the manager retreated to the dugout, Rogers induced hard groundball directly to Ruf, who fired home to Posey to retire Luke Raley trying to score the go-ahead run.

“Gabe came out and said, ‘Hey, I’ve got all the confidence in the world in you here, do you want to face Muncy?’” Rogers said. “And I said ‘Yeah,’ and we talked about where the defense would be playing and the sign package we’d be using and that was it.”

The next hitter, Justin Turner, entered the night 4-for-5 in his career against Rogers, but after falling behind in the count 2-0, the Giants’ reliever battled back and got Turner to fly out to end the frame.

With three plus pitches –a sinker, slider and changeup– Webb continued his success against the Dodgers as he held them to just three hits over six dominant innings. Two of Los Angeles’ singles came in the fifth inning against Webb as Bellinger snapped an 0-for-28 stretch against the Giants to begin the season by sneaking a leadoff single through the hole into right field.

Two batters later, Billy McKinney looped a single into right center field to score Bellinger from second and give the Dodgers a 1-0 lead. Center fielder Austin Slater threw McKinney out trying to stretch his single into a double and Webb didn’t allow Los Angeles to extend its lead as he pitched around a two-out base hit from Max Muncy in the sixth to keep the Giants within a run.

“I thought it was an excellent start by Logan,” Kapler said. “Even the mistakes were kind of in-zone, tougher pitches, and overall he continues to excel with his pace.”

Webb’s efforts were rewarded almost immediately as the Giants chased Dodgers starter Julio Urías in the bottom of the sixth inning after Austin Slater doubled and Posey tied the game with a RBI single to center field.

Third base coach Ron Wotus made an aggressive decision to send Slater, but the move paid off as Dodgers center fielder A.J. Pollock’s throw home was well off line.

With the Giants evaluating a variety of potential trades ahead of Friday’s deadline, acquiring another starting pitcher has been on the minds of Farhan Zaidi and Scott Harris for awhile.

Hours before Tuesday’s three-game series against the Dodgers began, the Giants were rumored to be one of the desired destinations for Nationals ace Max Scherzer, a three-time Cy Young Award winner who would immediately transform any club he joined. Though not likely, it’s possible Scherzer ends up in San Francisco as trading for the top available starting pitcher would also prevent the Padres and Dodgers from adding the right-hander.

Regardless of whether the Giants make a move for Scherzer, a middle-of-the-rotation arm or move forward with their current staff, it would be very difficult for the club to send Webb to the bullpen.

Despite missing more than five weeks with a shoulder injury, Webb has been brilliant since returning from the injured list as he’s allowed just four earned runs in 18.0 innings. The youngest member of the Giants’ roster hasn’t lost any of the momentum he built prior to hitting the injured list as he’s posted a 1.54 ERA in his last 35 innings while harnessing better command of all of his pitches.

Because of his youth and lack of experience in a pennant race, Webb might be the Giants’ preferred choice to send to the bullpen if they add another veteran starter, but it’s possible no one in the club’s current rotation is better positioned for second half success than Webb.