SAN FRANCISCO — Gordon Beckham hit an RBI single with two outs in the 10th inning and the Chicago White Sox beat the San Francisco Giants 3-2 on Tuesday night after blowing a two-run lead in the ninth.

The loss drops the Giants six games behind the Los Angeles Dodgers in the NL West standings. San Francisco is still just a half game back of the Pittsburgh Pirates and St. Louis Cardinals in the race for the two wildcard spots.

One batter after Jordan Danks was thrown out trying to score from third on a fielder’s choice, Beckham hit an 0-1 pitch from San Francisco reliever Santiago Casilla (1-2) past shortstop Brandon Crawford into left field. Sierra, who entered the game as a late defensive replacement, scored easily.

Adam Dunn hit a two-run home run off Giants starter Ryan Vogelsong in the first for Chicago, which wasted another strong start by Chris Sale when reliever Jake Petricka gave up four hits in the ninth.

Beckham, who made two stellar defensive plays including one in the ninth, bailed out the White Sox bullpen with only hit in five at-bats.

The Giants entered the ninth trailing 2-0 and loaded the bases with no outs.

Pablo Sandoval and Michael Morse singled. Matt Duffy ran for Morse. Travis Ishikawa singled to load the bases. Joe Panik grounded into a double play to make it 2-1. Brandon Crawford drove home the game-tying run with an RBI-single to right field off of Chicago relief pitcher Jake Petricka who came in to start the ninth.