SAN FRANCISCO -- If there wasn't a competition among Matt Cain, Tim Lincecum and Jonathan Sanchez before Tuesday night's game, there is now.

Cain one upped his fellow teammates with his best performance of the season, striking out 10 batters and allowing just two hits in eight shutout innings as the Giants took the second game of a four-game series against the Cubs in dramatic fashion, 2-1, at AT&T Park.

The burly right-hander not only put the Cubs' bats to sleep, but he also recorded his 100th strikeout of the season to give the Giants three pitchers with a 100 or more strikeouts before the All-Star break for the first time in the San Francisco era.

"It's pretty cool. I definitely haven't noticed that until the past couple of days when stuff has been on the Internet," Cain said. "It's definitely something that's good, and we've all been able to get deep into games, which sometimes doesn't happen when you get those strikeout numbers up."

For Cain, it's just the second time this season and the sixth time in his career that he has struck out 10 or more batters. Cain attributed his success on the mound to catcher Bengie Molina.

"Bengie just kind of kept calling a good game, going after their weaknesses," Cain said. "We were able to work at the knees with the fastball and change speeds with the curveball. We kind of got them off balance so they couldn't sit on something hard."

The strikeouts came and went, but it was Cain's poise on the mound and the Giants' defense that helped him get through two tough innings late in the game. In the sixth inning with two outs, Fred Lewis made a sliding catch in left-center field to prevent a double off the bat of Derrek Lee.

Then in the seventh inning after a lead off double by Daryle Ward, Aaron Rowand robbed Jim Edmonds of extra-bases when he made an over-the-shoulder catch as his momentum took him into the wall in center field. And if that wasn't enough, Jose Castillo made a spectacular stop at third, throwing off balance to first to get Mark DeRosa to end the eighth inning.

"That was awesome. There's nothing better than that," Cain said. "I definitely can say I got helped out by the ballpark tonight. Rowand went and got the ball off Edmonds, but the one that highlights the night was the diving play by Castillo."

Castillo, who made an error in the first inning, rebounded well with that great stop as Cain's pitch count reached 114.

"Omar [Vizquel] came to me and said, 'You just made the play of the game,'" Castillo said. "I just didn't want that ball to get by me, and when I caught it, I just turned and threw it. I've been playing long enough to know where first base is, so I just threw without looking."

Offensively, the Giants didn't do much, but the little they did was enough to earn them their fourth win in 19 games at home. Lewis was the sparkplug, scoring both runs in the game.

Lewis led off the bottom of the first with a single, then after advancing to third on a fielder's choice by Randy Winn, he scored on a perfectly executed double steal. According to manager Bruce Bochy, Winn was taking off on a hit-and-run and Lewis just ran once he saw catcher Geovany Soto throw to second.

In the fifth inning, Lewis, who hit a double to lead off, scored again on a single by Winn, giving the Giants a 2-0 advantage.

"Their guy [Jason Marquis] pitched well. We needed a great effort, and we're not the type of team that tries to slug it with the other team," Bochy said. "We executed well, we got a guy over and we got him in. It's the little things tonight that won the ballgame for us."

Closer Brian Wilson, who has a flair for the dramatic, picked up his National League-leading 23rd save of the season, but not before he allowed a run to score. Wilson needed nine pitches to finally strike out Ryan Theriot with runners on first and second to preserve the victory.

"I'm getting sick and tired of two-run leads," Wilson said. "I don't care how many runs I give up as long as we win."