Cain started and threw five perfect innings for the Giants in their 3-2 exhibition loss to the Chicago Cubs.

His performance recalled something special: the perfect game he spun against Houston on June 13, 2012, one of only 23 recorded in Major League history.

As was the case against the Astros, Cain received defensive help from Gregor Blanco. The center fielder rushed in to snare Mike Olt's sinking line drive to open the second inning. Playing right field in Cain's perfect game, Blanco ranged into the right-center-field gap to haul in Jordan Schafer's drive.

"We're trying to work him a little bit, make sure he's got his legs under him," Cain jokingly said of Blanco.

Besides Olt, no other Cub came close to mustering a hit. Cain struck out seven, fanning at least one batter in each inning, while coaxing four groundouts and four popups or flyouts.

"I threw good pitches when I was ahead on the count, which is always nice," Cain said. "At times you feel like you get in good counts and you're not able to finish guys, but today we were able to do that."

Giants manager Bruce Bochy cited Cain's concentration as a source of his success.

"Sometimes you drop your guard a little bit with two strikes, and it's not over yet," Bochy said. "You have to finish off hitters and today he made nice pitches with two strikes."

Cain's effort reflected his intent to improve upon 2013, when the three-time All-Star slumped to 8-10 with a 4.00 ERA. By now, the breakdown by halves looks familiar. Cain went 5-6 with a 5.06 ERA in 19 starts before the All-Star break, contrasting with 3-4, 2.36 in 11 outings afterward. The Giants' Opening Day starter a year ago, Cain was bumped to No. 2 by Madison Bumgarner, who performed more consistently last year.

Cain attempted to emphasize the positive in his mental approach toward this season.

"I personally tried to let some of it go, tried to forget the first half and then tried to build on what was going on toward the end of the season," he said.

Cain was near-perfect in his previous Cactus League outing, yielding one hit while striking out two in three innings last Wednesday against the Angels.

Chris Haft is a reporter for MLB.com. Read his blog, Haft-Baked Ideas, and follow him on Twitter at @sfgiantsbeat. This story was not subject to the approval of Major League Baseball or its clubs.