Beltran went deep off Tim Stauffer in the fourth inning and Lincecum singled in a run in the fifth, as San Francisco won for just the third time in nine contests.
The Giants, who remained two games behind Arizona for the lead in the NL West, split the two-game series and will host Houston for four this weekend.
Lincecum (12-10) gave up four hits and five walks, but fanned seven batters. He's allowed one run or fewer in eight of his last nine starts.
The Giants had lost each of their previous six games decided by one run, but Santiago Casilla made the lead hold up in the ninth by retiring the side in order for his first save of 2011.
The Padres, who had four hits, had a five-game winning streak snapped.
Stauffer (8-10) yielded six hits over six innings.
The Padres wasted a bases-loaded chance in the opening inning and with men at the corners in the fourth.
"He got into a couple of jams, but Timmy did what he does best, that's making great pitches when he has to," Giants manager Bruce Bochy said. "We needed that with what happened yesterday and our struggles here recently. It takes a great pitching effort to get you back on track."
Beltran homered to lead off the bottom of the inning, taking a 1-0 pitch over the wall in right. It was his first round-tripper in 13 games for the Giants since being acquired from the Mets. Beltran, who was in his second game off the disabled list, also hit his first career homer at AT&T Park.
Brandon Belt tripled leading off the fifth and scored on Lincecum's base hit to right.
That was the start of 11 straight San Diego batters retired in a row to finish the game.
Lincecum moved to 8-4 all-time against the Padres...MLB's all-time home run leader Barry Bonds was in attendance...San Francisco is 7-5 against the Padres this season.