CHICAGO -- The Chicago Cubs got another strong pitching performance Sunday. And this time, the lineup produced enough offense to salvage a victory in the three-game crosstown series.
"The fans are pretty into it and there is a lot of energy out there," Lopez said. "You know it's a pride thing in this city ... You have to keep your focus."
Starlin Castro hit an RBI triple off Gavin Floyd in the fourth inning and Ramirez followed with a drive to center for his 12th homer. Castro had two hits on the same day he was selected for the All-Star Game.
"You don't to be swept, especially at home and now we go on the road for seven games before the All-Star break," said Ramirez, who has seven homers in his last 10 games.
|More on ChiSox at Cubs|
"I feel pretty good right now. I get a good pitch to hit and I don't miss it," he said.
The White Sox captured the season series 4-2 with the Cubs' victories coming against Floyd (6-8). The right-hander gave up six runs over five innings in a June 20 loss at U.S. Cellular Field. He yielded seven hits in seven innings Sunday, three of them coming in the fourth.
The 35-year-old Lopez (1-2) surrendered infield singles to Mark Teahen in the third on a hard-hit ball that first baseman Carlos Pena stopped and Carlos Quentin in the fourth on a grounder deep into the hole at shortstop. But that was it.
Lopez struck out three and walked none while throwing 75 pitches in his third start for the Cubs since he was acquired in a trade with the Braves in May.
His efficient outing followed a four-hitter by Matt Garza in a 1-0 loss Saturday.
"We should have won that game yesterday," Ramirez said.
The White Sox broke through in the eighth. Teahen and Gordon Beckham had consecutive one-out singles to put runners at the corners, and Teahen came home when Kerry Wood threw a wild pitch with pinch-hitter Paul Konerko at the plate.
After Konerko worked a walk on a 3-2 pitch, Sean Marshall relieved and retired Juan Pierre on a popup. Carlos Marmol then struck out Alexei Ramirez on three pitches before working the ninth for his 17th save in 22 chances.
"Lopez put the ball over the plate," Pierre said. "He pitched with precision. He kept us off balance and threw all of his pitches -- fastball, slider, changeup -- over the plate.
"When you're in a position to sweep, you definitely want to sweep. But we did win the series, and we've got a little momentum. Gavin threw a great game, we just couldn't get him any runs."
AL All-Star Quentin started a relay from right field as the White Sox cut down a potential run in the third. Geovany Soto tried to score from first on Kosuke Fukudome's double off the wall, but Quentin made a good throw to second baseman Beckham, whose strong peg to A.J. Pierzynski was in plenty of time to get the sliding Soto.
The White Sox, trying to go over .500 for the first time since April 15, got the first two runners on against Lopez in the third, but Floyd bunted foul on a third strike and Pierre lined back to Lopez, who flipped to first to complete a double play.
"The pitchers can carry you so long and so much, and we have to help them," White Sox manager Ozzie Guillen said. "We've been winning a lot of games, but in the meanwhile, we wish our offense would start putting some numbers out there to make it a little bit easier for the pitchers."
Cubs RHP Ryan Dempster was scratched from his scheduled start Monday in Washington after spending Saturday night in the hospital with stomach problems and back pain. Dempster was back in the clubhouse Sunday and said he had some tests and some IV fluids but should be OK. Casey Coleman will be recalled from the minors to start against the Nationals. ... Castro is the youngest player in Cubs history to be chosen for the All-Star team. He turned 21 this past March. ... Although Konerko was left off the AL squad despite being a leader in numerous offensive categories with a .317 average, 21 homers and 62 RBI, he is on the final vote ballot. Konerko didn't start Sunday as slumping Adam Dunn started at first and went 0 for 4. ... Sunday's announced attendance was a season-high 42,311 -- the largest White Sox-Cubs crowd ever at Wrigley Field. The three-day attendance was 125,962, also the biggest for a three-game Sox-Cubs series at Wrigley. It also was the second largest attendance for a three-game series ever at Wrigley, surpassed by the 126,283 that came to watch the Yankees-Cubs last month.