Cain's 125-pitch masterpiece for San Francisco featured a pair of great plays by his corner outfielders. He got pinch-hitter Jason Castro on a grounder to third for his 27th and final out with the sellout crowd of 42,298 roaring.
It was the fifth no-hitter in the majors already this year and second perfect game. At a ballpark where Barry Bonds made home run history, Cain produced the signature moment for pitchers.
Left fielder Melky Cabrera chased down Chris Snyder's one-out flyball in the sixth, scurrying back to make a leaping catch at the wall. Cain raised both arms and slapped his glove in delight when Cabrera made the play.
Then, right fielder Gregor Blanco ran into deep right-center to make a diving catch on the warning track and rob Jordan Schafer for the first out of the seventh. The 27-year-old pitcher hugged Blanco in the dugout after the inning.
"Those were unbelievable catches," Cain said. "I mean that right there, that changes the whole thing."
Phillip Humber of the Chicago White Sox tossed the majors' last perfecto at Seattle on April 21. This is the second time in three years there have been two perfect games in the same season — before that, the only other time it happened was in 1880.
Cain (8-2) accomplished a feat even Hall of Famers Gaylord Perry and Juan Marichal couldn't with this storied franchise.
Not since 1917 have there been five no-hitters in a season by mid-June. The only year that came close was 1990, when Fernando Valenzuela and Dave Stewart each pitched no-hitters on June 29 — the fourth and fifth of the season.
This year, Johan Santana tossed the New York Mets' first no-hitter on June 1 and six Seattle pitchers shut down the Los Angeles Dodgers last Friday. Jered Weaver had one for the Los Angeles Angels on May 2.
The Astros were no-hit for the fifth time and first since Carlos Zambrano did so for the Cubs on Sept. 14, 2008.
The Giants made a big commitment to Cain this spring, locking him up for a long haul — and he showed exactly why general manager Brian Sabean has vowed to keep his talented pitchers. In a week when the city's attention turned to golf and the U.S. Open, Cain delivered his most impressive gem yet in his 216th career start.
The 125 pitches were the most ever thrown in a perfect game.
The two-time All-Star who had long been the Giants starter who endured a lack of run support already was rewarded with a new $127.5 million, six-year contract in early April before the season started. This certainly meant as much or more to the homegrown pitcher.
Cain threw 86 of his pitches for strikes, faced just four full counts and still clocked 90 mph in the ninth. Cain followed up Madison Bumgarner's 12-strikeout gem in Tuesday night's 6-3 win.
It was the first no-hitter since departed left-hander Jonathan Sanchez pitched the Giants' last one on July 10, 2009, against the Padres at AT&T Park.
The Astros were no-hit by the Giants for the second time. Marichal did it on June 15, 1963.
Ted Barrett became the first umpire to work behind the plate for two perfect games. He also worked David Cone's 1999 perfecto.
Catcher Buster Posey rushed the mound as Cain raised his arm. His teammates jumped the dugout rail as the final out was made, a moment reminiscent of that improbable World Series championship in 2010 at Texas.
"I can't thank Buster enough," Cain said. "I didn't even question once what he was calling."
Cain's wife, Chelsea, fought tears when shown in the stands as the celebration began, then made her way to the dugout for a congratulatory hug and kiss.
Cain had come close already this season — not once, but twice. In his second start of the year, in the team's home opener April 13, he one-hit the Pirates in a 5-0 win, then allowed only two hits over nine innings in the Giants' 11-inning, 1-0 win over Cliff Lee and the Phillies.
The Giants produced their first back-to-back 10-strikeout performances by one pitcher since 1978. On May 17, 1978, Vida Blue fanned 11 against the Cubs, then after an off day, John Montefusco struck out 10 at Los Angeles.
Cabrera, Brandon Belt and Blanco all hit two-run homers and the Giants produced an offensive outburst rarely seen at home this season and rarely seen on nights Cain has pitched.
On this night, he threw nine of his initial 11 pitches for strikes, commanding his repertoire with a dazzling fastball.
Cain, who hit one drive into McCovey Cove alongside U.S. Open golfer Dustin Johnson before the game to show off one of his other favorite pastimes, sat by himself in the dugout between innings.