Posey hit a grand slam in the top of the 10th inning to lift the Giants to a 10-7 win over the Milwaukee Brewers on Friday night.
It was the Giants' seventh victory in the last eight games and sixth in the last seven on the road.
"We were able to carry over the way we were swinging the bat before the All-Star break," Posey said.
Joe Panik singled, Mike Yastrzemski walked and Brandon Belt singled to load the bases for Posey who hit the first pitch from Matt Albers (4-3) to deep left-center. It was Posey's fifth career grand slam and first this season.
"Great way to start the second half," Giants manager Bruce Bochy said. "It was good to see Buster give us a cushion."
Keston Hiura, who had three hits, got his eighth homer of the season off Mark Melancon in the bottom of the 10th for the final margin.
Christian Yelich tripled off All-Star Will Smith (2-0) to start the bottom of the ninth and scored on Mike Moustakas' ground out to tie the game at 6. It was Smith's first blown save of the season, but he picked up the win thanks to Posey's fourth homer this season.
Trying to preserve a 5-4 lead, All-Star Josh Hader coughed up Tyler Austin's third career pinch-hit home run in the top of the eighth and then Brandon Crawford's first home run off a left hander this season with two outs in the ninth.
"Hitting two homers off Hader is hard to do," Posey said.
Hader knew exactly what went wrong.
"I just made two mistakes right over the middle of the plate," he said. "The only correcting is just not leaving the ball over the middle. That's where I get in trouble."
Hader has surrendered home runs in two of his last three appearances. He's allowed nine home runs which matches his total from 2018.
Rookie right-hander Shaun Anderson faced the Brewers for the first time and baffled them with four-seam fastballs, sliders and curveballs. He struck out a season-high eight, including NL MVP Yelich three times, but tired in the sixth.
A walk and a double by Moustakas ended Anderson's 11th career start. Reyes Moronta came on and gave up Ryan Braun's two-run double off the glove of third baseman Evan Longoria. Braun advanced on a wild pitch and scored on Thames' single to put the Brewers up 5-4.
Austin Slater's third home run of the season, a two-run shot in the fifth off Milwaukee starter Chase Anderson, evened it up for the Giants after the Brewers scratched out the game's first two runs.
Longoria's two-run blast in the sixth off Corbin Burnes hit the left-field foul pole and gave the Giants a 4-2 lead.
Giants: Manager Bruce Bochy said Madison Bumgarner was good to go for his Saturday start. The left-hander was knocked out of the game against St. Louis in his previous outing. José Martínez lined a wicked shot off Bumgarner's pitching elbow in the second inning last Saturday. X-rays were negative, but he had an elbow contusion.
Brewers: LHP Gio González (left arm fatigue) allowed two runs and four hits in two innings in his first rehab start on Thursday with Class-A Carolina.
Posey's first grand slam since June 24, 2015, against San Diego was the fourth grand slam by a Giant this season and the first since Austin Slater's on July 6th against St. Louis. It was the first by a Giant in extra-innings since Hector Sanchez's in the 11th on April 23, 2014 at Colorado.
Brewers manager Craig Counsell took a guarded view of the home runs allowed by Hader.
"We have to live with the fact that he's going to give up some runs sometimes," Counsell said. "That's how he gives up his runs. That's the nature of how he pitches."
Hader has allowed 17 hits, nine of them home runs, this season. However, the Brewers manager still has confidence in him.
"Every time we can get him in a game, we're going to feel really good about it," Counsell said.
Giants: LHP Bumgarner (5-7, 4.03 ERA) is 7-4 with a 2.76 ERA in 13 career starts against the Brewers, including 3-1 with a 3.31 ERA in five outings at Miller Park. It's the second time he's facing Milwaukee this season. He went six innings and took a no decision at Oracle Park in June.
Brewers: RHP Zach Davies (7-2, 3.07 ERA) makes his second start of the season against the Giants. He is 0-2 with a 2.81 ERA in three career outings against San Francisco, including a 5-3 loss at Oracle Park on June 14th.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP—Sports