Updated

Yusmeiro Petit had never thrown a shutout, let alone a complete game in the majors. On Friday, he was one out away from becoming the 24th pitcher to throw a perfect game in MLB history.

Petit (3-0) had retired the first 26 Arizona batters he faced before Eric Chavez stepped to the plate as a pinch-hitter.

After working the count full, Chavez smacked a fastball into right field that a sliding Hunter Pence trapped for the only Diamondbacks' hit of the game.

Petit didn't let it faze him, though, as he got A.J. Pollock to ground out to third to end the game and finish off the San Francisco Giants' 3-0 victory over Arizona.

"I was never thinking of what was happening in the game," said Petit through an interpreter "But after I got the last two outs I just wanted to keep throwing good pitches. I'm just happy that I'm up here and hope I can stay."

The 28-year-old Venezuelan native was looking to join Matt Cain as the only other Giant to throw a perfect game. Cain turned the trick last year on June 13 against the Astros.

Petit finished the game throwing just 95 pitches, 69 of which went for strikes as he struck out seven batters, induced seven fly outs and 13 groundouts.

"It was a beautiful game and a tremendous display of pitching," said Giants manager Bruce Bochy. "I couldn't be happier for him. He's been fighting his way to get up here and has been trying to send a message that he belongs here. That game tonight was very impressive with how he pounded the strike zone on both sides. He had 25 guys pulling for him so hard out there."

Pence went 3-for-3 with a solo home run and three runs scored for the Giants, who had dropped three of four coming into the game.

Patrick Corbin (13-6) tossed his third complete game of the season as he gave up all three runs on eight hits with a walk and five strikeouts for the Diamondbacks, who have dropped four of six.

The Giants got the only run they needed in the second as Pence scored on a fielder's choice from Brett Pill that saw a bad throw from Chris Owings.

In the fourth, Pence doubled to start the frame and later scored on a Hector Sanchez single.

Pence's 19th home run of the year came in the eighth inning as he lined a pitch over the left field wall.

The closest the Diamondbacks came to a hit through the first eight innings was in the sixth. With two outs, Corbin hit a liner to shallow left that Juan Perez, who came into the game in the inning as a defensive substitute for Pill, snagged with a headfirst dive.

"We made a lot of quick out and had a lot of ground balls. I have to tip my cap to him, he pitched a great game. We couldn't solve him once again," said D'backs manager Kirk Gibson.

Game Notes

Petit was just 12-20 over six seasons in the majors coming into the game ... Petit had pitched for the Diamondbacks from 2007-2009 ... His longest previous outing was eight innings against Pittsburgh while with the D'backs on August 4, 2009 ... San Francisco has won 11 of the 17 games against Arizona this season ... Cain pitches for the Giants on Saturday in the third of this four- game set, while Brandon McCarthy will take the mound for the Diamondbacks.