SAN FRANCISCO -- Right-hander Tim Lincecum pitched his second career no-hitter Wednesday and second in two seasons against the San Diego Padres, leading the San Francisco Giants to a 4-0 victory at AT&T Park.

Lincecum recorded his seventh career shutout and 10th career complete game, striking out six and walking only one. He also went 2-for-3 with a walk at the plate, collecting his second and third hits of the season and scoring his first two runs.

Lincecum threw his first career no-hitter last season against San Diego on April 13, 2013, at Petco Park, striking out 13 and walking four in a 9-0 Giants victory.

With a sellout crowd on its feet Wednesday, Lincecum retired center fielder Will Venable on a ground ball to second baseman Joe Panik for the final out and was mobbed by his teammates.

Coming into the game, Lincecum was 14-6 with a 2.47 ERA in 27 starts against the Padres. He was 6-3 against the Padres in 12 starts at AT&T, holding them to one or fewer runs eight times.

In his previous start against Arizona, Lincecum struck out only one batter for the second time in his career, allowing four runs and seven hits in a 4-1 loss.

Lincecum struck out the first two Padres he faced Wednesday, but throughout most of the game he pounded the strike zone with quality pitches and made San Diego hit the ball.

Lincecum issued a one-out walk to third baseman Chase Headley in the second but struck out first baseman Tommy Medica and retired second baseman Alexi Amarista on a ground ball.

In the top of the fourth with one out, Padres right fielder Seth Smith smoked a one-hopper to first base, but Buster Posey made a backhand grab and stepped on first for the out. Then in the top of the fifth, Amarista hit a line drive to right, but right fielder Hunter Pence moved a few steps to his left for the out.

The Giants were in desperate need of a strong outing by a starting pitcher. Coming into the game, Giants starters had a 5.05 ERA in June after posting marks of 3.98 in April and 2.85 in May.

Lincecum delivered.

The Giants snapped their five-game losing streak at AT&T and avoided being swept by the Padres, who won the first two games in the three-game series by a combined score of 13-2.

Padres right-hander Ian Kennedy (5-9) allowed four runs and nine hits in 6 1/3 innings, striking out eight and walking one intentionally.

The Giants took a 1-0 lead in the bottom of the second when shortstop Brandon Crawford tripled off the wall in left-center field and scored on catcher Hector Sanchez's sacrifice fly. Venable appeared to misjudge how far Crawford's high fly would travel. He kept drifting back instead of sprinting before it was too late.

The Giants extended their lead to 2-0 in the third as Lincecum helped himself at the plate. Leading off, Lincecum grounded an infield single up the middle for his second hit of the season in his 23rd at-bat. Posey moved Lincecum to third with a two-out single. Left fielder Carlos Quentin appeared to make a late break on the line drive that hit just in front of his glove.

Third baseman Pablo Sandoval drilled an RBI double to left-center field as Lincecum scored his first run of the season.

The Giants added two runs in the seventh. Lincecum hit a leadoff single to left and advanced to second on Pence's single off Kennedy. Posey brought them both home with a double to center off right-handed reliever Tim Stauffer.

NOTES: The Giants placed CF Angel Pagan (strained lower back) on the 15-day disabled list Wednesday, retroactive to June 15, and called up power hitting corner INF Adam Duvall from Triple-A Fresno. Pagan is eligible to be activated as soon as Tuesday against St. Louis at AT&T Park. Duvall leads the Pacific Coast League with 23 home runs and hit .297 with 67 RBIs in 67 games. ... The Padres will interview former Miami Marlins general manager and president of baseball operations Larry Beinfest on Friday in San Diego for their GM job, MLB.com reported. Beinfest will be the first candidate interviewed to replace Josh Byrnes, who was fired Sunday.