SAN FRANCISCO (AP) — Andres Torres hit a two-out RBI single in the 10th inning and the San Francisco Giants handed the Arizona Diamondbacks their seventh consecutive loss with a 6-5 victory on Sunday.

Torres hit a sharp liner to right off Carlos Rosa (0-1) for the first game-ending hit of his career and his fourth single of the game. Juan Uribe scored after starting the rally with a two-out single.

Brian Wilson (1-0) pitched a 1-2-3 10th with two strikeouts for the win, the closer's third straight outing not allowing a baserunner.

The Giants rallied in the ninth against closer Chad Qualls, getting an RBI single from Freddy Sanchez and a tying RBI groundout from Pablo Sandoval.

Arizona's skid matches its worst of the season.

Torres is batting .370 since being moved into the leadoff spot May 23 at Oakland — and the Giants are 5-2 in those games. He also scored twice.

This finish should give San Francisco a nice boost heading into Monday's anticipated Memorial Day matchup with the Rockies at AT&T Park. It looks to be a dandy: Colorado ace and nine-game winner Ubaldo Jimenez vs. two-time reigning NL Cy Young Award winner Tim Lincecum.

Eli Whiteside added a single in the 10th in his lone at-bat, helping the Giants win their sixth in a row at home against Arizona after also sweeping the D-backs here from Sept. 29-Oct. 1.

Adam LaRoche drew a go-ahead, bases-loaded walk with one out in the eighth inning for Arizona, which couldn't hold a 5-3 lead. Chris Snyder hit a two-run homer in the second for the D-backs.

Aubrey Huff homered leading off the eighth for the Giants, just the second time in Aaron Heilman's last nine road appearances that he gave up a run.

Make it six hits and four RBIs in two games for Giants rookie sensation Buster Posey.

Posey doubled twice, singled and drove in a run a day after he was called up and had three hits in his season debut in a 12-1 win Saturday night. The Giants' fifth overall pick in the 2008 draft was hitting .349 for Triple-A Fresno before being promoted to the big leagues. He received a rousing ovation when he stepped in to hit in the first. There were chants of "Posey! Posey!" when he batted in the eighth and 10th.

Arizona finally produced after managing just three hits in 57 at-bats and getting outscored 17-1 in the first two games of the series. Manager A.J. Hinch benched struggling left fielder Conor Jackson and moved Justin Upton into the No. 2 hole. Upton added an RBI double in the ninth.

Diamondbacks left fielder Gerardo Parra saved a run in the seventh with a perfect throw home to get Ryan Rohlinger.

The Giants loaded the bases in the first against Ian Kennedy and Bengie Molina hit a sacrifice fly. Posey followed with an RBI double.

Giants starter Todd Wellemeyer matched his career high of seven strikeouts. He allowed two runs and six hits in 6 2-3 innings.

NOTES: Qualls blew his fourth save. ... All six of Huff's homers this year have been at home and leading off an inning. ... C Molina is 2 for 34 over his last 10 games. Whiteside replaced him in the 10th. ... Arizona's Jackson is in an 0-for-13 funk since his six-game hitting streak ended Wednesday at Colorado. ... CF Aaron Rowand and SS Uribe weren't in the starting lineup for San Francisco but Uribe entered in the eighth as a defensive replacement. Rohlinger earned a rare start at SS but was replaced by Uribe after straining his left hamstring in the hard collision at home. ... The Giants sold out for the sixth time in 2010, drawing 41,394. ... Giants LHP reliever Jeremy Affeldt made his first appearance in a week since injuring his left hamstring at Oakland.