Posey put the Giants in position to win with an RBI double that made it 1-1 in the sixth inning, then smacked a 3-2 pitch from Ronald Belisario (2-3) for the game-winner.
Posey's two key hits accounted for half the hits the Giants managed in the game.
San Francisco starter Barry Zito went five innings, giving up just one run despite allowing six hits and four walks. Five San Francisco relievers, capped by Sergio Romo (2-2) throwing the top of the ninth to get the win, followed Zito to the mound.
Dodgers starter Clayton Kershaw, activated from the bereavement list for the game, carried a no-hitter into the sixth inning. Marco Scutaro's triple to center field end the no-hit bid and Kershaw ceded three hits and fanned five over seven innings.