CHICAGO -- Gordon Beckham and Dayan Viciedo hit two-run home runs, John Danks pitched effectively into the seventh inning and the Chicago White Sox snapped a four-game losing streak with an 8-2 victory over the Giants on Tuesday night.
The slumping White Sox had managed a total of six runs in their previous four games.
Viciedo, who was just 2 for 23 on the homestand before Tuesday, went 2 for 4. His fifth-inning blast ended a stretch of 51 at-bats without an RBI.
Danks (6-5) settled down after a somewhat slow start and gave up two runs -- one earned -- and five hits in 6 1-3 innings. In his last five starts, the left-hander is 3-1 with a 1.51 ERA.
Hunter Pence went 2 for 4 with a home run for the Giants, who have dropped four straight and seven of eight.Giants starter Matt Cain (1-5) allowed eight runs -- seven earned -- and 10 hits in five innings.
Pence opened the scoring with a homer in the first inning, and the Giants made it 2-0 with an unearned run in the third.
The White Sox tied it in the bottom of the third as Adam Eaton singled with two outs, stole second and then trotted home on Beckham's two-run shot.
Chicago took a 5-2 lead with three runs in the fourth. Jose Abreu led off with a single and one out later Alexei Ramirez and Viciedo both singled to load the bases.
Alejandro De Aza popped up in foul ground on the first pitch for the second out, but Tyler Flowers drew a walk to drive in a run and make it 3-2. Eaton followed with a slow grounder to shortstop that Brandon Crawford fielded cleanly but threw wide of first base after rushing to get the speedy Eaton.
Eaton was credited with a single and one RBI as both Ramirez and Viciedo scored for the three-run lead. Crawford was charged with an error for allowing the second run to score and both runners (Flowers and Eaton) to advance a base.
Chicago added three runs in the fifth to break the game open. Adam Dunn had an RBI single and two batters later Viciedo hit a two-run, two-out homer for an 8-2 margin.
NOTES: Giants manager Bruce Bochy was a teammate of Tony Gwynn's and later managed the Hall of Famer, who died Monday. "Just a huge loss for baseball and San Diego," Bochy said. "We all know what a great player he was and a great hitter. But he is getting recognized for being such a tremendous person." . White Sox C Tyler Flowers entered 18 for his last 109 at-bats with 49 Ks as his average dropped to .250. . Giants OF Angel Pagan (lower back) was out of the lineup for a second straight game and is listed as day-to-day. . C Buster Posey was used at DH after taking a foul off mask on Sunday. ... The finale of the brief two-game series has a marquee pitching matchup of RHP Tim Hudson (7-2, 1.81) vs. LHP Chris Sale (5-1. 1.97)