New York: The San Francisco Giants fought back to record an 8-7 road win against the San Diego Padres on Saturday and maintain their slim lead over the Los Angeles Dodgers in a tight National League West baseball division.

Los Angeles (66-55) earlier took down the Atlanta Braves 6-2 before the Giants rallied from 4-1 down against the Padres in San Diego to claim the win and stay half-a-game ahead.

The Padres (52-70) fans sensed a potential upset when Chase Headley powered his 20th home run of the season, a three-run shot in the bottom of the third, to set up a 4-1 lead, but four runs in the fifth for the Giants put paid to their hopes.

Marco Scutaro, Pablo Sandoval, Hunter Pence and Joaquin Arias all helped men home for the Giants in a momentum-shifting fifth inning.

“The fifth inning didn’t have the results I wanted to,” Padres pitcher Stults said.

“I put a couple pitches right where I wanted to, and they were able to barrel it up.

“You can’t make them hit it at people sometimes, but overall, I was able to keep us in the game.”

Carlos Quentin homered for the home side in the sixth to tie things up at 5-5, but Buster Posey drove in Scutaro with a sacrifice fly and Arias drove Sandoval home with a timely single in the seventh to regain the lead for the Giants.

Posey and Pence then struck back-to-back doubles in the ninth to stretch the lead to 8-5.

The Padres almost pulled the game from the fire with two runs in the bottom of the ninth when down to their last out but fell just short.

“It was a tie game at five with three innings to go. We had the go-ahead run at the plate, the tying run at first in the ninth. Our guys fought back,” Padres manager Bud Black said.

The Giants start a three-game series against the Dodgers on Monday but are not thinking playoffs just yet.

“It’s early,” Sandoval said. “We’ve got a lot of baseball coming up.”