SAN FRANCISCO -- Buster Posey capped a two-run rally in the bottom of the 10th inning with a one-out RBI single to center field, handing the San Francisco Giants a 5-4 victory over the Los Angeles Dodgers on Saturday night.
The dramatic win allowed the Giants to even the three-game series at a victory apiece after the Dodgers won 3-2 on Friday night on a tie-breaking homer by Justin Turner in the ninth inning.
The Giants (37-26) picked up the game in the standings that they lost to the Dodgers (33-30) in the series opener and re-opened a four-game advantage atop the National League West.
Handed a 4-3 lead on a home run by Adrian Gonzalez in the top of the inning and shooting for an 18th save, Dodgers closer Kenley Jansen (2-2) got Jarrett Parker to pop out to lead off the 10th before Denard Span hooked a double into the right-field corner.
Joe Panik then tied the game with a single to left-center.
After Brandon Belt blooped a single to right, Posey singled up the middle, scoring Panik with the game-winner.
Right-hander Chris Stratton (1-0), the Giants' ninth pitcher, was credited with the win despite allowing the Dodgers to take the lead in the top of the 10th.
The Dodgers appeared headed to their second consecutive one-run win when Gonzalez hit Stratton's second pitch over the left-field fence for his sixth homer of the season.
But Stratton, pitching for just the third time this season, retired three of the next four guys he faced to keep the Giants within one, setting up the dramatics in the bottom of the inning.
Panik had two hits and Matt Duffy added two RBIs for the Giants, who improved to 23-13 against NL West competition.
Gonzalez, Turner and Trayce Thompson had two hits apiece for the Dodgers, who out-hit the Giants 11-7.
The Dodgers rallied from 2-0 and 3-2 deficits, drawing even at 3-3 in the seventh in an inning in which the Giants used five relievers.
Chase Utley, who had the inning's only hit, scored the tying run when right-hander Cory Guerrin issued a two-out, bases-loaded walk to Thompson.
Guerrin then got Joe Pedersen to fly out to center field to escape further damage.
Neither starting pitcher got a decision.
Dodgers left-hander Scott Kazmir left two batters into the bottom of the sixth, during which the Giants took their 3-2 lead.
Panik led off the inning with a single and moved up a base when Kazmir walked the final batter he faced, Brandon Belt.
The Dodgers then got only one out apiece on two potential double play grounders induced by reliever Louis Coleman, with Panik advancing a base on each and scoring the go-ahead run.
Kazmir allowed three runs and three hits in his five-plus innings. He struck out three.
The Giants' first two runs off Kazmir came in the first inning on RBI singles by Duffy and Brandon Crawford.
Giants starter Jeff Samardzija couldn't hold the 2-0 lead, allowing a run in the third on an RBI single by Yasmani Grandal and one in the fifth on an RBI double by Gonzalez.
The right-hander was pulled after Gonzalez's hit, and right-hander George Kontos struck out Thompson to keep the game tied.
Samardzija gave up two runs in 4 2-3 innings. He allowed seven hits, walked two and struck out three.
NOTES: Golden State Warriors coach Steve Kerr and guard Klay Thompson attended the game. Thompson's brother, RF Trayce Thompson, batted fifth for the Dodgers. ... The Giants made a significant change in their batting order Saturday, moving 1B Brandon Belt to third and demoting 3B Matt Duffy, who homered Friday night off LHP Clayton Kershaw, to fifth. ... Giants manager Bruce Bochy announced before the game that RHP Matt Cain (strained right hamstring) will be activated off the 15-day disabled list on Monday and start the series opener that night against the Milwaukee Brewers. ... Dodgers LHP Hyun-Jin Ryu (torn labrum) has been scheduled to begin an injury-rehab stint in the minors Sunday at Single-A Rancho Cucamonga, Ryu hasn't pitched a major league game since Sept. 12, 2014. ... The Dodgers released INF/OF Jose Tabata, who had been playing at Triple-A Oklahoma City, off their 40-man roster. Tabata, who had been hitting .244 in the minors this season, had a guaranteed $4.5 million contract for 2016.