CHICAGO (AP) -- Gavin Floyd needed a night like this. So did his team, for that matter.
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 also avoided being swept for the first time this season.
"We needed that," Beckham said. "We've been doing a good job of not getting swept. ... We're playing hard, we're doing the right thing. It's just coming a little harder the last week and a half."
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.
"It was frustrating," Floyd said.
But at the same time, he had "a peace about it" and kept believing he would get through it. He also felt he pitched better than the numbers showed, at least in some of those recent starts.
"There were games where I felt really good and (just didn't) get the results," he said. "It's part of baseball, I guess."
Floyd certainly had things working for him. He gave up a double to David DeJesus and triple to Starlin Castro leading off the third and sixth innings but worked out of it both times.
The White Sox hitters did their part, too - particularly Beckham.
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 bottom line was the walks again with him," manager Dale Sveum said. "He's got to throw strikes. He just can't seem to maintain innings without walking anybody."
Wells 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 on the last three knuckles on his right hand by the barrel of a broken bat as Escobar grounded to second to end the inning.
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.
Sveum said X-rays showed no fractures, and Coleman said he won't miss any time. The next game is at Arizona on Friday.
"I didn't see it until it hit me," Coleman said. "It's really scary when something like that happens, but I got lucky it was just the barrel that hit me in the knuckle. It's scary, when you don't see it, especially."
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 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."