SAN FRANCISCO -- Barry Zito shook off the worst outing of his big league career to give the Giants another impressive effort from their starting rotation.
Buster Posey's first home run of the season made sure it held up.
Zito (3-1) bounced back five days after getting shelled by the Milwaukee Brewers when he failed to make it out of the third inning.
He allowed five hits in seven innings against the Padres, struck out four, walked one and did not give up run for the third time in four starts.
"If you let outings bleed into the next one, that's when things kind of go bad, so you just have to stick with your approach," Zito said after beating San Diego for the first time in nearly two years.
"I felt pretty good in my game and the results weren't there last (time). I felt pretty good today and the results were there. That's just the nature of the game."
Zito's outing followed gems by San Francisco starters Madison Bumgarner and Tim Lincecum, and helped the Giants sweep the Padres in a series of three games or more for the first time since Sept. 12-14, 2011.
San Diego, held scoreless for the last 21 innings, had opened its six-game trip by taking three straight from the Los Angeles Dodgers.
Zito retired 13 of his final 16 batters before leaving to a standing ovation after fanning Will Venable to end the seventh.
He had given up nine runs in 2 2/3 innings during Tuesday's 10-8 defeat at Milwaukee, ending his streak of 16 starts without a loss.
"Good for Z," Giants manager Bruce Bochy said. "It was a great job on Barry's part of bouncing back. You have to be resilient in this game. He had good command today and made his pitches."
Gaudin allowed one hit over the final two innings to complete the Giants second straight shutout.
San Diego has started 5-13 for the second straight season. The Padres didn't have an extra-base hit in the game and failed to get a runner to second base over the final seven innings.
"I didn't think it would turn out this way after our at-bats in L.A.," San Diego manager Bud Black said. "Bumgarner pitched a great game, Lincecum picked it up and Zito just carried it over."
Posey's first home run of the season was just the 11th this year for the power-starved Giants. Before the two-out, two-run drive off Eric Stults (2-2) in the fifth, Hunter Pence, Pablo Sandoval and Brandon Crawford had accounted for all of San Francisco's homers.
Angel Pagan put San Francisco ahead with a two-run double in the third, two innings after his heated discussion with plate umpire Bob Davidson. Pagan believed he had been hit on his back foot by an 0-2 pitch from Stults and argued with Davidson for several minutes, at one point repeatedly pointing his finger at the umpire while standing in the batter's box.
Replays were inconclusive and San Francisco's leadoff hitter eventually grounded out. After his double knocked in Andres Torres and Crawford, Pagan made it 3-0 when he scored on Sandoval's single.
Sandoval also reached on a two-out infield single in the fifth and scored on Posey's first regular-season home run since Oct. 2.
Stults, who had won four of his previous six starts against the Giants, gave up all five runs and eight hits in seven innings. He walked none for the second time this season.
"I felt like I was making good pitches," Stults said. "Even with Crawford's (single), that wasn't a strike. Before you know it, it's first and third and I fall behind Pagan 3-0."
The game was halted briefly in the sixth inning when Padres left fielder Kyle Blanks was injured while crashing into the wall chasing down Joaquin Arias' fly ball. Blanks fell to the ground and walked off the field with Black and a team trainer.
Blanks left the game and received stitches over his left eyelid.
Padres OF Carlos Quentin has been working out at Petco Field while serving his eight-game suspension for charging Dodgers pitcher Zack Greinke. ... LHP Clayton Richard, who was scratched from Saturday's game with flu-like symptoms, is scheduled to make his next start Tuesday. ... San Francisco RHP Ryan Vogelsong (1-1) pitches the series opener against Arizona on Monday. ... RHP Jason Marquis (1-1) starts for the Padres when they begin a six-game homestand against the Brewers on Monday.