ATLANTA — Freddie Freeman's bases-loaded, line-drive single off closer Sergio Romo capped a two-run rally in the ninth that lifted the Atlanta Braves to a 6-5 win over the San Francisco Giants on Saturday.

B.J. Upton hit two homers off Chad Gaudin, but the Braves trailed 5-4 entering the ninth.

Romo (3-3) walked pinch-hitter Evan Gattis, who was replaced by pinch-runner Reed Johnson, with one out. Andrelton Simmons followed with a grounder that skipped past third baseman Joaquin Arias for an error, putting runners on first and second.

Jason Heyward followed with a liner that fell in front of left fielder Andres Torres, loading the bases.

Justin Upton took a close 3-2 pitch for a ball to force in the tying run. The pitch, which had Upton backing away, was close to the inside part of the plate and Romo walked toward the plate to express his disagreement.

Freeman then came through with the game-winning single to right field.

Braves closer Craig Kimbrel (2-1) struck out Hunter Pence to end the ninth with runners on first and second. Pence drove in two runs.

Gaudin gave up four runs on eight hits in five-plus innings.

Pence had a run-scoring single in the Giants' three-run third inning and a sacrifice fly in a two-run fifth. The Giants, who began the day 1½ games behind first-place Arizona in the NL West, had won three straight.

Braves starter Mike Minor gave up five runs, four earned, on seven hits and a walk in six innings.

San Francisco relievers Jean Machi, Javier Lopez and Jeremy Affeldt combined for three scoreless innings before Romo blew the save in the ninth.

B.J. Upton's long second-inning homer landed about halfway up the lower section of the left-field seats.

Upton's two-run homer to center field in the sixth drove in Brian McCann, who doubled. The homer cut San Francisco's lead to 5-4 and knocked Gaudin out of the game.

Simmons committed two errors after beginning the day with only four miscues for the season. Simmons' fielding error on Tony Abreu's grounder led to an unearned run in the fifth. Buster Posey followed with a run-scoring double, which drove in Torres. Abreu scored on Pence's fly ball to right field.

Simmons made a wild throw after fielding an infield single by Juan Perez to open the sixth, but Minor pitched out of the jam.

The Giants took the lead in the third inning with three runs on four hits, including back-to-back RBI doubles by Torres and Abreu, who had three hits. Pence added a run-scoring single.

NOTES: The Braves will wait until after Sunday night's game to name a second pitcher to join Paul Maholm as the starters in Tuesday's doubleheader against the Mets. One possibility is rookie LHP Alex Wood, who was working as a starter for Double-A Mississippi before he was called up on May 30 to pitch out of the Braves' bullpen. ... RHP Brandon Beachy, recovering from 2012 elbow ligament-replacement surgery, had been on target to make his 2013 debut on Tuesday before having tenderness in the elbow. Manager Fredi Gonzalez said Saturday the plan is to "back up a little bit and let that kind of calm down, and then restart." ... The series ends Sunday night when Braves RHP Julio Teheran faces Giants RHP Tim Lincecum.