Posey had two hits and drove in both runs for the Giants, who won their fourth straight.
"It was a good feeling," Posey said of his shot. "The game was already way too long for being 1-1. I was enjoying the moment, taking in all the excitement."
Posey hit a 3-2 pitch off Ronald Belisaro that landed about 15 rows up in the left-field bleachers. It was his first hit in eight at-bats against the Dodgers right-hander. Belisaro struck him out five times and walked him once.
"We don't hit too many of them, but they are coming at a great time," Giants manager Bruce Bochy said. "He's a guy you want up there. He ran a deep count and got a pitch he could handle."
The Giants used five relievers behind Zito, with Chad Gaudin, George Kontos, Jeremy Affeldt and Santiago Casilla keeping the game close. Sergio Romo (2-2) pitched the ninth, allowing one hit and striking out two, to earn the victory.
Clayton Kershaw took a no-hitter into the sixth before Marco Sctuaro tripled into the right-center-field gap with one out. Posey's two-out double to the same area tied the game at 1. Hunter Pence followed with a single to center and Posey was thrown out at the plate by Matt Kemp.
Pence threw out Hanley Ramirez at third base in the top of the inning. Ramirez left the game with a left hamstring injury.
"It's amazing how many guys have been hurt, and our big guys," said Kershaw. "But we can't make excuses; Donnie [Mattingly] says that. We just have to find guys to go up there that are healthy. It definitely is amazing how many we've had."
Giants starter Barry Zito worked himself into and out of trouble all night, leaving with no outs in the sixth and recording a no-decision when the Giants scored in the bottom of the sixth.
Zito worked hard, throwing 95 pitches in his five-plus innings. He gave up a run on six hits while walking four. He also struck out a batter.
"From a personal standpoint I'm not happy with the way I pitched at all," said Zito, who said he is most definitely a Metallica fan. "But baseball is like that sometimes. I kept trying to make pitches throughout the night and was able to make pitches when I needed. We got some big double plays."
The Dodgers got their leadoff hitter on base in the first six innings, four from Zito walks and twice on hits.
"It's not ideal to have as many leadoff hitters on as we did but give Zito credit for making tough pitches," Posey said. "To be able to strand as many as we did, we wanted to take advantage."
Posey took a foul tip off the inside of his leg at one point but was able to shake it off after a few moments.
"Better than the hand but still a sensitive spot," said Posey, who acknowledged he "listens to" Metallica, who performed the national anthem before the game.