SAN FRANCISCO -- Giants manager Bruce Bochy was relieved to see Matt Cain on the mound Sunday, and not the guy who struggled in his previous three starts.
"He's back to who he is," Bochy said. "He had more pitches working and better command. He went out there, relaxed, and pitched."
Cain tossed eight scoreless innings and Eli Whiteside had a pair of RBI doubles, leading San Francisco to a 5-1 victory over the Chicago Cubs.
"He was Matt Cain today," Whiteside said. "That's a tough lineup to shut out for eight innings. He had good stuff."
Eugenio Velez, Juan Uribe and Pablo Sandoval each had two hits and drove in a run for the Giants, who had lost six of eight. San Francisco remained five games behind NL wild card-leading Colorado with six games left.
"We have to win all of our games and they have to lose all of their games," Velez said. "That's how we have to look at it. We have to keep playing."
Cain (14-7) gave up three hits, struck out eight and walked two, snapping a personal three-game slide and setting a career high for wins. Cain, who picked up his first home win since July 6, has not allowed a run in his last 23 innings against the Cubs.
Randy Wells (11-10) allowed five runs and 10 hits over 5 2/3 innings for Chicago. Bobby Scales had an RBI triple.
"It seems like it's a broken record with me putting the team in a hole early," Wells said. "It wasn't my day again. I feel great and feel like I'm throwing OK. I'm a big believer in setting the tone early and their guy comes down and gets us out and I go out there and let up a run. That's the thing I was upset about the whole day - not setting the tone. I'm not happy about that."
Sergio Romo got the first two outs of the ninth before giving up a double to Jeff Baker and Scales' triple. Jeremy Affeldt entered and walked Koyie Hill. Brian Wilson then struck out pinch-hitter Reed Johnson for his 37th save in 44 chances.
"Matt Cain was awfully good today," Cubs manager Lou Piniella said. "He pounded the strike zone and had a good breaking ball."
The Cubs had won six of seven to clinch at least a .500 record for the season.
San Francisco scored three runs in the sixth to build a 5-0 lead. Whiteside doubled in Travis Ishikawa for the second time in the game and scored on Velez's single. Sandoval added an RBI single.