SAN FRANCISCO -- So long the hard-luck pitcher with little run support, Matt Cain suddenly doesn't need much.
He's been that dominant.
Cain pitched nine scoreless innings but settled for a no-decision. He didn't mind considering San Francisco's result.
Randy Winn lined an RBI single down the first-base line with two outs in the 10th inning and the Giants beat the Pittsburgh Pirates 1-0 on Wednesday for a three-game sweep on the heels of a 3-7 road trip.
"It was huge for us and we definitely needed it," Cain said.
After Cain's impressive outing, Brian Wilson (3-4) worked the 10th for the victory. This marked the Giants' first sweep of the Pirates in their waterfront ballpark since July 31-Aug. 2, 2001.
San Francisco scored against Matt Capps (2-6), and Eugenio Velez got it started with a leadoff single. He was sacrificed to second and scored on Winn's lone hit in five at-bats and his first walk-off hit since Aug. 6, 2007.
The Pirates lost their fifth in a row to finish a 1-7 road trip.
"Matt was awesome today," San Francisco skipper Bruce Bochy said. "He went up there and threw another gem. We won the game because of him even though he didn't get the win."
After the game, San Francisco acquired Pittsburgh All-Star second baseman Freddy Sanchez for minor league pitcher Tim Alderson. The Giants medical staff twice examined Sanchez to make sure his tender left knee was fine. Sanchez was a late scratch Monday night and didn't play at all this series, giving San Francisco's medical staff ample time to evaluate him. He also sat out Friday night's game at Arizona.
The Pirates already traded shortstop Jack Wilson and pitcher Ian Snell to the Seattle Mariners earlier Wednesday for shortstop Ronny Cedeno, Triple-A catcher Jeff Clement and three minor league pitchers.
Cain, named an NL All-Star but unable to participate because of an arm injury, struck out four and walked two in an impressive 111-pitch outing. He missed a chance at his 13th win, which would match his career high also done during his standout rookie season in 2006. He hasn't lost in six starts since a June 26 defeat at Milwaukee.
"I don't know if anything's different," he said. "I'm just trying to take that little step of improvement of being more focused, and I think that's what has helped me a ton."
After going 0 for 4 in his Giants debut Tuesday night, first baseman Ryan Garko had his first hit for his new club with a second-inning single. Garko came to San Francisco from Cleveland in a trade Monday.
Pirates left-hander Zach Duke hung tough with Cain, working out of some tough jams to keep the game scoreless. The Giants squandered scoring chances in the second, fourth, fifth and seventh innings.
But Duke failed to pick up his team-leading 10th win, which would match his career high from 2006.
"It's a tough one. Matt Cain was on top of his game again," Duke said. "I had to be [equally sharp] to match up with him to give us a chance, so thankfully it was as good of a game as it was."
Pirates manager John Russell twice came out to argue with second-base umpire Mike DiMuro, the first on Juan Uribe's stolen base in the fifth and again in the top of the seventh when Garrett Jones was caught stealing. Russell questioned then whether second baseman Uribe got the tag down in time.
- Pirates reliever John Grabow made his 385th appearance since 2004, matching Alan Embree for most in the majors by a lefty during that span.
- San Francisco captured the season series (4-2) for the first time since 2005.
- Giants CF Aaron Rowand plans to test his torn forearm tendon by playing light catch Thursday. He was hit by a pitch in the arm at Atlanta on July 20 and is limited to pinch-hit duties.
- Cain is one of seven pitchers in San Francisco history to win 12 of their first 14 decisions, joining Hall of Famers Gaylord Perry and Juan Marichal, and Rick Reuschel, John Burkett, Shawn Estes and Jason Schmidt.
- Pittsburgh returns home to kick off a 10-game homestand Friday against Washington.