Gavin Floyd pitched four-hit ball into the seventh, Gordon Beckham homered, and the struggling Chicago White Sox beat the Cubs 7-0 Wednesday to avoid a three-game sweep.

Floyd (5-7) put aside his recent problems. Beckham matched a career-high by driving in four runs, and the White Sox got an easy win after dropping six of seven.

They finally showed some pop after managing just 19 runs over the previous seven games, including a 2-1 loss in which Jake Peavy went the distance the previous night.

Adam Dunn and Paul Konerko each delivered RBI singles as the White Sox grabbed a 2-0 lead in the third. Beckham then chased Randy Wells (1-2) with a run-scoring single in the fourth and broke it open with a three-run drive off Scott Maine in the sixth, making it 6-0.

That was more than enough on a night when Floyd came through with one of his best performances. The right-hander struck out four while walking just one batter in 6 1-3 innings. It was a huge improvement after going 1-4 with a 10.38 ERA in his previous six starts. He also got his first win in five outings against the Cubs and is now 1-3 against them.

While Floyd dominated on the mound, Beckham provided the biggest blows at the plate. After knocking out Wells in the fourth, he put this one away in the sixth when he drove his ninth homer to the sports bar just beyond the right-field wall.

That shot came after Eduardo Escobar singled and Alejandro De Aza walked. By then, the White Sox were in control, something Wells never had.

He struggled in a big way after being reinserted into the rotation with Ryan Dempster going on the disabled list this week because of right lat tightness.

Wells threw 69 pitches in 3 2-3 innings and allowed five hits and four walks without a strikeout. The right-hander was wild from the start and paid for it as the White Sox scored two in the third. He walked Escobar and De Aza to start the inning, and they came around on the singles by Dunn and Konerko.

The Cubs got a scare in the seventh when reliever Casey Coleman was hit near his right hand by the barrel of a broken bat as Escobar grounded to second to end the inning.

Manager Dale Sveum and a trainer immediately came out to the mound. Coleman walked off on his own power, but Manuel Corpas came out to start the eighth.

Notes: The White Sox held Orlando Hudson out of the lineup and went with Escobar at third base, instead. "Just a mental break," manager Robin Ventura said. Hudson, who is new to the position, committed a throwing error that helped set up David DeJesus' two-run single on Tuesday and was in a 4-for-26 slide at the plate. ... Sveum had no issue with Peavy saying after Tuesday's game that the White Sox have "got to show up and take advantage of these opportunities" against weak teams. ""The record dictates those kind of things," Sveum said. "When you've won 20 games coming into a series and the other team's won 35, that's the way it is. That's the way you look at schedules. That's just what we all do. That's just the nature of the game."