Atlanta’s Andrelton Simmons celebrates as he crosses home for the game-winning run Saturday against the Giants. Freddie Freeman knocked Simmons in with a bases-loaded single.

Atlanta’s Andrelton Simmons celebrates as he crosses home for the game-winning run Saturday against the Giants. Freddie Freeman knocked Simmons in with a bases-loaded single.

ATLANTA — The Atlanta Braves showed the San Francisco Giants on Saturday why they have the best home record in the majors.

Freddie Freeman capped a two-run rally in the ninth inning with a bases-loaded single off Giants closer Sergio Romo, giving the Braves a 6-5 victory before a crowd of 47,178 at Turner Field.

“You always want to come through in a situation like that,” said Freeman, who had his second walk-off hit of the season. “It’s nice playing before a packed crowd when they are standing up and doing the chop.”

It was Atlanta’s ninth final at-bat victory of the season and fifth at home, where the Braves have a 22-8 record.

A walk, error by third baseman Joaquin Arias and a single by Jason Heyward loaded the bases with one out. Romo walked Justin Upton on a close 3-2 pitch to force in the tying run.

“I obviously thought it was a ball, but it was close,” Upton said of the near miss inside. “It’s a pitch the pitcher wants. That’s the inches in a game. It went my way this time.”

Upset with the call, Romo tried to regain his composure.

“I had to focus,” he said. “We still had an opportunity to keep playing. You got to dig down deep right there and stay focused.”

Romo worked the count to 1-1 against Freeman with two sliders and then threw a fastball that Freeman pulled to right field for the winning single.

“I don’t look for anything,” the first baseman said. “I just put my foot down and swing and hope for the best.”

Romo said, “It’s never a good feeling when you let your team down.”

B.J. Upton hit two homers for the Braves off Giants starter Chad Gaudin, his second pulling the Braves within a run in the sixth.

The San Francisco bullpen shut down the Braves until the ninth, though.

Braves closer Craig Kimbrel allowed two hits and a walk in the top of the inning but got out of the jam, thanks in part to a caught stealing, and ended up with the victory.

Braves starter Mike Minor escaped with his five-game winning streak intact despite allowing more than three earned runs in a game for just the second time this season. The left-hander, who came in with a 2.44 ERA, was charged with five runs, four earned, in six innings while giving up seven hits. He struck out seven and his only walk was intentional.

B.J. Upton picked on a 2-1 fastball from Gaudin with one out in the second and pulled a long home run into the left-field seats. The lead didn’t last long, though, as the Giants struck for three runs with two outs in the third.

Andres Torres and Tony Abreu, who finished with three hits, had consecutive RBI doubles. Hunter Pence followed an intentional walk to Buster Posey with a bloop hit to right field to drive in the third run.

Atlanta’s Dan Uggla flirted with a home run to center field in the fourth, the third time in two innings that a drive off Gaudin was caught on the warning track. The Braves cut the Giants’ lead to a run in the inning anyway, though. Chris Johnson had a two-out single to score Upton, who had stolen second base.

Posey struck in the fifth, crushing a run-scoring double off the center-field fence. Pence followed with a sacrifice fly to score Abreu, who had reached on the first of two errors in the game by shortstop Andrelton Simmons, and the Giants led 5-2.

Posey, starting his fourth game of the season at first base, extended his hitting streak to 13 games against the Braves. He is 21 for 51 with two homers and 16 RBIs in the streak.

B.J. Upton pulled the Braves back within a run the sixth and chased Gaudin in the process. The center fielder followed a leadoff double by Brian McCann by picking on a low 3-2 fastball and lifting a homer over the center-field fence.

It was the fourth homer in June and eighth of the season for the ex-Tampa Bay Ray, who came in batting just .159.

“B.J. had a great game,” Freeman said. “Hopefully, those homers will get him going.”

NOTES: RHP Tim Lincecum (4-6, 4.70) will start for the Giants against Braves rookie RHP Julio Teheran (4-3, 3.62) in the series finale on Sunday night. Lincecum, who turned 29 on Saturday, had his best start of the season against the Braves in San Francisco on May 12, allowing two hits in seven scoreless innings and striking out seven. … Giants 2B Marco Scutaro, batting .332 when hit by a pitch Tuesday in Pittsburgh,, hopes to avoid a trip to the disabled list. He took batting practice on Saturday and will be fitted with a customized orthotic split for his injured left pinky when the team returns to San Francisco on Monday. … RHP Brandon Beachy, who had been tentatively scheduled to start for the Braves in one of the games in Tuesday’s doubleheader against the Mets, will be shut down for a while after feeling soreness in his surgically repaired elbow during a rehab start for Triple-A Gwinnett at Rochester on Thursday. … The Giants hadn’t posted consecutive road shutouts since September 2010 until Thursday’s 10-0 win over the Pittsburgh Pirates and Friday night’s 6-0 victory over the Braves.