SAN FRANCISCO -- In hopes of winning his first game of the season on national television, San Francisco Giants starting pitcher Matt Cain wanted to look his best Sunday night.
So the veteran asked permission for the team to wear its all-black caps, the same ones the Giants had donned in Detroit last October in their World Series-clinching, Game 4 victory.
Cain earned that elusive first win with 7 1/3 innings of five-hit pitching and Hunter Pence provided two doubles and four RBIs as the Giants completed an early-season whitewashing of the National League West, taking down the Los Angeles Dodgers 4-3 to sweep a series from their fourth different opponent.
"I just wanted to pitch well," Cain downplayed of his first win after opening the season with an 0-2 record and an unsightly 6.49 ERA. "The guys have been playing well. I wanted to finish it off and give us a good start."
The Giants, who took over the lead in the NL West with their sixth consecutive win, led wire-to-wire to complete the three-game weekend sweep after overcoming deficits and waiting until their last at-bat to beat their California rival with home runs the previous two nights.
The sweep followed similar hat-trick successes over the Colorado Rockies, San Diego Padres and Arizona Diamondbacks. The defending World Series champions also have been swept twice in their first 10 series, by the Milwaukee Brewers and the Padres.
"He's a competitor," Pence, who drove in all the Giants' runs, observed of Cain. "You find out what you're made of when you go through tough stretches. This shows what he's made of."
Cain stranded three Dodgers runners in scoring position in the first three innings as the Giants were building their lead, then settled into a season-best rhythm that saw him permit only two hits to the final 20 batters he faced. He wound up allowing five hits, three walks and one run while striking out four.
As it turned out, the three-time All-Star did more sweating in the dugout than on the mound, as Giants relievers George Kontos and Jeremy Affeldt gave up three hits and a walk, producing three runs, after inheriting a two-out, one-on situation in the eighth.
Adrian Gonzalez got the big hit of the uprising for the Dodgers, a two-run, pinch single up the middle off fellow left-hander Affeldt to get the visitors on the scoreboard. The N.L.'s sixth-leading hitter was making his first appearance in the series after having suffered a sore neck in a collision with an umpire while chasing a pop fly Wednesday in Colorado.
Dee Gordon's infield hit off Affeldt scored Juan Uribe with a third run in the inning, before Jean Machi, the Giants' fifth pitcher of the eighth, induced pinch-hitter Jerry Hairston Jr. to ground out to shortstop on a full count with two runners aboard.
Sergio Romo navigated the top of the Dodgers order in the ninth inning without allowing a hit to earn his 12th save and cap the Giants' ninth one-run win of the season.
"The biggest thing for me was we'd lost five in a row," Pence said of the stretch immediately preceding the club's current winning streak. "This has solidified us even more."
The powerful No. 5 hitter saw to it the Giants wouldn't need to come from behind as they had in all five previous victories during their streak. His doubles drove in a run in the third and two more in the fifth, after his run-scoring infield out in the first inning gave Cain a lead he never relinquished.
"We've had a lot of different heroes in this stretch of wins," noted Pence, pointing specifically to Buster Posey and Guillermo Quiroz, each of whom had a walk-off homer in the series. "I happened to be in a situation to get it done."
Being on the losing end of a sweep for the second time this season, the Dodgers fell into a tie for last place in the National League West. Left-hander Hyun-Jin Ryu (3-2) took the loss, giving up four runs on eight hits over six innings to end a personal three-game winning streak.
Matt Kemp, who reached base three times and scored the Dodgers' first run, applauded the team's comeback, but only to a certain extent.
"It shows we have fight," he said. "But any loss is a bad loss. You don't want to lose games."
Dodgers manager Don Mattingly had a more positive outlook on the series of one-run defeats.
"I'd like to sit here and say I'm all disappointed," he said, "but I'm not disappointed in how we played today. We kept coming.
"I feel better about our club walking out of here than I did coming in. I didn't think we were playing well coming in."
NOTES: The Giants still have never lost to the rival Dodgers in San Francisco when leading by three or more runs at any point in the game, a streak that dates back to 1958. ... The Dodgers plan to activate LHP Chris Capuano from the disabled list and start him Monday night against the Arizona Diamondbacks in the opener of a nine-game homestand. Capuano made only one start in April before suffering a strained left calf on April 16. ... After his two catchers hit walk-off homers in the first two games of the series, Giants manager Bruce Bochy found a way to start them both Sunday, with Saturday's hero Quiroz behind the plate and Friday's game-winner Posey moving to first base. ... Giants leadoff man Angel Pagan was given the day off after straining his right hamstring in the outfield Saturday night. Pagan had started 29 of the Giants' first 30 games. ... Likewise, valuable Dodgers utilityman Hairston, nursing a slight groin strain suffered running the bases Saturday, was not in the starting lineup. He pinch hit in the eighth and grounded out, limping significantly as he reached first base.