Lincecum (2-0) controlled the Padres on four hits, walking two and striking out eight for the Giants, who won a second straight at home after enduring a three-game sweep in Milwaukee.
Sandoval provided the game's only offense with a two-run blast in the fourth.
San Diego's Andrew Cashner (0-1) absorbed loss while making an emergency start after scheduled pitcher Clayton Richard came down with flu-like symptoms.
The right-hander yielded just Sandoval's homer in four innings, walking one and fanning five.
Astronomers offer more expansive view of universe
McPhee, Cokas 'working on their marriage' after affair