SAN DIEGO -- Xavier Nady, who has struggled all season, first with the Washington Nationals, then with the San Francisco Giants, slugged a pinch-hit home run to tie the game in the ninth inning and Hunter Pence followed with a two-run shot as the Giants rallied from three runs down after seven innings to beat the San Diego Padres 7-5 Sunday afternoon.
The Giants, who scored two in the eighth and three in the ninth, spoiled the home finale for the Padres before 33,407 at Petco Park.
Sergio Romo pitched the ninth for the Giants to earn his 13 save, striking out pinch-hitter Carlos Quentin with the tying run aboard. Shane Loux (1-0) was the winner.
The Padres finished the home portion of the season 42-39 and are 75-84 overall. The Giants improved to 93-66.
Both Giants home runs came off Padres closer Huston Street (2-1), who had converted all 23 of his previous save opportunities.
"Obviously in that situation against a guy who has been good all year, I'm just trying to get on base," Nady said. "But I got the count (1-0) in my favor and put a good swing on it.
"The ball carries pretty well here in the day, so I knew I got it.
"Really, though, to come back against the Padres bullpen, a bullpen with a lot of good arms, is really good."
Giants manager Bruce Bochy wasn't happy with his team's play early, saying, "We were awful."
But he liked the finish.
"We kept fighting, and that's the way we have to play," Bochy said. "Nady was huge and Pence had a really good at-bat."
Street was disappointed in the finish, but realistic.
"I wouldn't say the first one was necessarily a bad pitch," Street said. "It just caught a little more of the plate, and he put a good swing on it. The second was a bad pitch. It just backed up on me. You make mistakes and you get beat."
Tim Lincecum's last start before the National League playoffs was spoiled by a trio of home runs and Evereth Cabrera's legs.
The Giants right-hander, who started the season horribly but has rallied of late, surrendered home runs to Logan Forsythe, Yasmani Grandal and Chase Headley.
With two outs in the third, Cabrera walked and stole second and third. On a full-count pitch, Forsythe homered into the second deck of the Western Metal Supply Co. building in left field.
Grandal greeted Lincecum with a homer to deep right-center field to start the fourth, a 420-foot shot.
Cabrera stole a run in the fifth when he again walked with two outs. He stole second and third and scored on catcher Hector Sanchez's throwing error at third base.
Cabrera has 41 steals on the season, the most for a Padres player since current first base coach Dave Roberts stole 49 in 2006. Cabrera is only the 14th Padres player to steal as many as 40 bases in a season.
In the sixth, Headley homered to right on the first pitch from Lincecum. It was the 31st homer of the season for Headley and his NL-leading 113th RBI.
"I've made some steps," Headley said. "I've done some things I wanted to do this year.
"I worked real hard in the offseason and all season to improve on some specific things. And I've been able to accomplish some things. I think once the season ends I'll be able to look back a little bit more and reflect."
Lincecum gave up just four hits, but three left the ballpark. He also gave up a homer in his last outing, a four-inning performance against Arizona in which he was tagged for seven earned runs.
"Headley hit a slider," Lincecum said. "The guy has had a good year and put a good swing on it.
"Forsythe hit a bad pitch ... up and in. That pitch was a ball. Grandal hit a change up.
"I was kind of jumping up and down after the home runs, but I threw a lot of quality strikes. Overall, except for the home runs, it was a pretty good outing. I executed pitches and hit spots."
The Giants touched Padres starter Edinson Volquez for a run in the first inning when Gregor Blanco led off with a single, stole second, went to third on a groundout and scored on Aubrey Huff's groundout.
The Giants got another run in the fourth after Brandon Belt singled and Sanchez singled him to third. Joaquin Arias singled, but Padres right fielder Chris Denorfia threw Belt out at the plate.
Lincecum then walked to load the bases and Blanco walked to force in a run.
Volquez threw two pitches to Huff in the fifth before he was removed with what Padres manager Bud Black said was "cramping in both legs, calf primarily. He fought through it the whole game. As the game wore on, it got to the point where he was very uncomfortable. It didn't look like he was going to get any better."
Brad Boxberger came on to throw two shutout innings, and Brad Brach blanked the Giants in the seventh.
Luke Gregerson took over in the eighth and was tagged for singles by Huff and Pence. Joe Thatcher was summoned from the bullpen to face Belt, who drove in pinch-runner Francisco Peguero with a broken-bat single to right.
Sanchez singled to center to load the bases. Brandon Crawford's sacrifice fly scored Pence to make it a one-run game.
Right-hander Dale Thayer came on to get Arias and pinch-hitter Pablo Sandoval on strikes, leaving two runners on base.
NOTES: Grandal made his 50th start of the season, giving the Padres three catchers -- Nick Hundley (56), John Baker (51) and Grandal (50) -- with 50 or more starts. According to the Elias Sports Bureau, no major league team since 1900 has had three catchers make 50 or more starts in a season. ... Giants catcher Buster Posey entered Sunday's game leading the National League with a .337 average. He did not play on Sunday. The last catcher to lead the NL in hitting was Ernie Lombardi of the Boston Braves in 1942. ... In lining up their pitching for the playoffs, the Giants' starting rotation for the Dodgers series is right-hander Matt Cain (16-5, 2.77 ERA), left-hander Barry Zito (14-8, 4.19) and right-hander Ryan Volgelsong (14-9, 3.46).