SAN FRANCISCO (AP) Justin Maxwell took advantage of a second chance to drive in the winning run.
Maxwell was robbed of a big hit in his previous at-bat, but his single with one out in the 10th inning sent the San Francisco Giants to a 3-2 win over the Los Angeles Dodgers Thursday for a three-game sweep.
In the eighth inning, with the bases loaded and two outs, Maxwell smacked a liner up the middle, but second baseman Howie Kendrick made a diving catch to end the threat and preserve a 2-1 Dodger lead.
''I go into every at-bat looking to hit the ball hard. I was ready to hit,'' Maxwell said of his winning single. ''Winning is fun. I can't wait to get on the plane and celebrate with the team.''
A day after they edged the Dodgers by the same 3-2 score with a run in the ninth, the Giants again frustrated their division rivals.
''It was a great series,'' Giants' manager Bruce Bochy said. ''It could have gone either way the last two games. It's been a tough homestand and this made it not so bad.''
The Giants rallied to score the tying run in the ninth when Casey McGehee led off with a single and Brandon Crawford tripled against Joel Peralta.
Juan Nicasio (0-1) gave up a single to Angel Pagan to open the 10th and got Buster Posey on a fly out. Pagan stole second and Brandon Belt was walked intentionally ahead of Maxwell.
''Angel is our catalyst,'' Bochy said. ''He's a tough out and he gives us speed. He got us going and got the stolen base. He looked determined to get home.''
Santiago Casilla (2-0) pitched the 10th for the win as the Giants swept the Dodgers at home for the first time since May 2013. The defending World Series champions have won four of five following an eight-game losing streak.
''This shows you what this year is going to be, how this division is going to be,'' Dodgers manager Don Mattingly said. ''Buckle up.''
The Dodgers had brought a seven-game winning streak into AT&T Park.
Pagan, Maxwell and Joe Panik each had two hits for the Giants.
Alex Guerrero homered and singled and is batting .474 (9 for 19) with four homers and 12 RBIs for the Dodgers. Adrian Gonzalez also homered.
Los Angeles starter Mike Bolsinger, who did not allow a run in 11 minor league innings, took a shutout into the sixth. He finished allowing one run on five hits. He walked two and struck out five.
Bolsinger, the reigning PCL Player of the Week, was recalled from Triple-A Oklahoma City to make the start.
Giants starter Ryan Vogelsong gave up two runs on three hits in six innings. He walked one and struck out five.
In the sixth, Bolsinger gave up a one-out walk to Panik and a single to Pagan. After Posey struck out, Belt singled home a run.
Dodgers: C A.J. Ellis, pulled from Wednesday's loss with a bruised right hand, did not play. X-rays were negative and he's expected to be ready by Friday.
Giants: OF Hunter Pence (fractured left forearm) is swinging off a tee with a wooden bat. He had been using a wiffle bat. ... RHP Erik Cordier (right forearm strain) has made three rehab appearances for Single-A San Jose, totaling three scoreless innings with seven strikeouts. INF Travis Ishikawa (lower back strain) had a setback and will be rested.
Dodgers: RHP Zack Greinke (2-0, 1.83) takes the mound against the Padres in San Diego on Friday. He's 2-0 in with a 1.74 ERA in five career starts at Petco Park.
Giants: RHP Chris Heston (2-1, 0.87) gets the start against the Colorado Rockies on Friday in Denver. Heston is the first Giants rookie to start a season with outings of at last six innings and one or fewer earned runs since 1914.