Lincecum threw his first no-hitter at San Diego on July 13, 2013.
The Giants, who had dropped 18 of 22 games after they lost the opener Friday, won two straight to win only their second series in nearly a month.
Brandon Belt drove in two runs for San Francisco and Hunter Pence had three hits, extending his season-best hitting streak to 11 games, and scored three runs.
Rookie Joe Panik added an RBI double.
Three relievers combined with Lincecum on a four-hitter. Santiago Casilla pitched the ninth for his third save in six chances.
Yasmani Grandal hit a two-run homer, his seventh, off former closer Sergio Romo in the eighth inning to cut the Giants' lead to 5-3.
The Padres did not get their first hit off Lincecum until there were two outs in the fourth.
Belt singled in a run in the first and had a sacrifice fly in San Francisco's two-run eighth.
NOTES: Lincecum's career best for scoreless innings is 29 in 2009. ... Giants 3B Pablo Sandoval, who left Saturday night's game with a left elbow bruise after he was hit while swinging at a pitch, did not play. ... The Giants' 5-3 win Saturday night in 10 innings was just the club's third victory since moving to San Francisco in 1958 in which the team won with a tying homer in the ninth inning and a winning home run in the 10th, according to information provided to the Giants by the Elias Sports Bureau. ... Giants RHP Ryan Vogelsong (5-5, 3.86 ERA) is scheduled to face A's RHP Jesse Chavez (6-5, 3.23) in the opener of a three-game series at Oakland on Monday. ... The Padres travel to Colorado with RHP Ian Kennedy (6-9, 3.87) going against Rockies LHP Tyler Matzek (1-2, 4.25) in the opener of a three-game set.