Updated

Matt Cain became the first pitcher in the Giants' long history to twirl a perfect game, retiring all 27 Astros he faced in dominating fashion Wednesday.

Cain (8-2) recorded a career-high 14 strikeouts, matching Sandy Koufax for the most punchouts in a perfect game, while the San Francisco offense pounded out 15 hits in a 10-0 rout.

It was the 22nd perfect game in Major League history and second this year. The White Sox's Philip Humber accomplished the feat on April 21 against the Mariners.

The Giants now have 14 no-hitters in their history -- six since moving to San Francisco. Jonathan Sanchez was the last to do so on July 10, 2009 against the Padres.

Cain threw 125 pitches in the masterpiece and was backed by quality defense, along with a plethora of offense, along the way.

Gregor Blanco went 2-for-5 with a home run and three RBI, but will most be remembered for a sensational diving catch along the warning track in right- center in the seventh inning.

"I don't know how [Blanco] caught that ball," Giants manager Bruce Bochy simply stated.

Brandon Belt also had two hits, a home run and drove in three, while Pablo Sandoval went 3-for-4 while knocking in a pair for the victors.

San Francisco's season-high output was obviously overshadowed by Cain, who now has 15 career complete games and six shutouts but was never more perfect than he was Wednesday.

"First time through the lineup, I felt like I had good stuff and was able to locate the ball where I wanted to," Cain said at the postgame press conference with an ice pack on his right shoulder. "I felt like something could happen."

Jordan Schafer had Houston's best chance at reaching base early on, but his ground ball leading off the fourth barely bounced foul by the first-base bag.

Shafer later struck out, and the Astros' next quality swing came with one out in the sixth when Chris Snyder smoked a ball to left field that nearly cleared the fence. But Melky Cabrera, who also hit a two-run homer, caught it just in front of the Budweiser decal on the wall to keep the perfect game in tact.

Blanco's grab in the seventh one-upped Cabrera's, as he tracked down Schafer's gapper to right with a dead sprint and timed his dive perfectly in front of the warning track. Before he hit the ground, the ball landed at the top of his glove, and he held on as he slid toward the wall.

"The coaches told me to play a little more towards the gap," Blanco recalled. "I was aware what was going on, and I said to myself I have to catch it."

Cain, who signed the richest contract for a right-hander pitcher in MLB history earlier this year, ran the count full to Jed Lowrie two batters later, but came through with a strikeout to end the inning.

After throwing 103 pitches through seven frames, Cain needed just 11 to get through the eighth, then induced a pair of flyouts to left to open the ninth.

Jason Castro was Cain's final victim, and the pinch-hitter's inside-out swing nearly handcuffed Joaquin Arias at third. Arias backpedaled near the outfield cutout and double-clutched before firing a perfect strike to Belt at first, sending the AT&T crowd into a frenzy.

Cain was mobbed by his teammates at the mound and was treated to a beer bath as he made his way to the clubhouse.

J.A. Happ (4-7) was on the opposite end of the spectrum from Cain, lasting just 3 1/3 innings and surrendering eight runs on 11 hits en route to his fourth straight losing start.

Cabrera made it 2-0 with a home run in the first inning, and Belt added a two- run shot of his own to straightaway center in the second.

Arias doubled and scored on a Blanco groundout later in the second, and the Giants tacked on two more on RBI singles by Sandoval and Belt in the third.

Happ was mercifully pulled with the bases loaded in the fourth, and Rhiner Cruz limited the damage to Sandoval's run-scoring fielder's choice.

Blanco tacked on a moonshot, two-run blast to right field in the fifth.

Cain singled prior to the blast, something none of the Astros could say they did against him.

Game Notes

Cain, who was 1-3 with a 4.69 ERA in seven previous appearances against the Astros, has won a career-high tying seven straight starts and lowered his ERA to 2.18. He has 10 career double-digit strikeout games...The Astros were no- hit for the fifth time...This is the second time in three years there have been two perfect games in the same season. The only other time that happened was 1880...There have been five no-hitters in the majors already this year...Koufax fanned 14 Cubs in his perfect game on September 9th, 1965...Belt has gone deep in two straight games after going homerless in his first 49...The Giants are 14-6 after left-handed starters this season...San Francisco goes for the three-game series sweep on Thursday with Barry Zito toeing the rubber opposite Wandy Rodriguez.