Scott Kazmir got the San Francisco Giants into a jam and rookie reliever Camilo Doval got them right out of it.

Doval got three huge outs on eight pitches at a pivotal juncture for the Giants, who beat the free-falling San Diego Padres 8-6 Wednesday night to take a two-game lead in the NL West. Kris Bryant hit a bases-clearing double and Buster Posey had four hits and scored three times.

The Giants got some help in their push for their first division title since 2012 when the defending World Series champion Los Angeles Dodgers lost 10-5 at Colorado. The Dodgers have won the division eight straight seasons.

The Giants, whose 99-53 record is the best in the majors, pulled within one win of reaching 100 for the eighth time in franchise history.

CLICK HERE FOR MORE SPORTS COVERAGE ON foxnews.1eye.us

The Giants raved about the performance of Doval, a 24-year-old Dominican who relieved Kazmir with the bases loaded, no outs and one run already in during the fifth inning. Doval (4-1) struck out Manny Machado on three straight sliders and then got Tommy Pham to ground into an inning-ending double play.

"We definitely had a little chat right after the half inning in the dugout, just thanking him and basically saying I owe him dinner," Kazmir said. "It's unbelievable. He's got ice in his veins. It's impressive how young he is and still to be able to, in just that big of a moment, to be that composed and be able to make those pitches, especially to Machado to start it off. That was amazing."

Kazmir, a 37-year-old lefty, got through four scoreless innings before getting into a jam that could have swung the game for the Padres. Kazmir opened the fifth by walking Victor Caratini, allowing a single to pinch-hitter Jake Marisnick and walking Fernando Tatis Jr. A catcher interference call against Posey while Jake Cronenworth was batting brought in a run. Manager Gabe Kapler then turned to Doval.

Kapler called it "one of the gutsier performances of the year from anybody in our pen."

Tatis hit his NL-leading 40th homer for the Padres, who moved closer to elimination as their brutal collapse continued. They lost for the 10th time in 12 games, a skid that has dropped them from a one-game lead for the second wild-card spot to six games behind red-hot St. Louis, with Cincinnati and Philadelphia each 1 1/2 games ahead of them.

"I wish I could celebrate in a different story, but it's been a long year, a lot of ups and downs, especially coming back from those injuries," said Tatis, who's battled a recurring injury to his left shoulder. "At the end of the day, I'm pretty happy with the results and how I bounced back and this is history. It's something to celebrate."

San Diego is a loss away from .500.

Tatis came to bat with two outs in the ninth and two runners on and flied out to left.

Bryant, acquired from the Chicago Cubs at the trade deadline, hit a bases-loaded double to the gap in right-center with one out in the first for a 3-0 lead. Opener Vince Velasquez (3-8) got into trouble right away when leadoff batter Tommy La Stella reached on catcher interference on Caratini, Brandon Belt walked and Posey singled. LaMonte Wade Jr., who had a go-ahead hit in the ninth inning of Tuesday night's 6-5 win, struck out before Bryant doubled.

The Giants took an 8-1 lead thanks to RBI singles by Brandon Crawford and Mike Yastrzemski in the sixth, and Posey's RBI double and Wade's two-run single in the seventh.

Tatis homered off Jarlin Garcia with one out in the three-run seventh. He became the fifth player in Padres history to reach that mark and the 10th player in baseball history to reach it at age 22 or younger.

Kazmir allowed an unearned run and four hits, struck out three and walked three.

NICE D

Crawford made a sensational play in the fourth when he gloved Wil Myers' grounder, spun spun all the way around and then made a slightly off-balance throw to get him at first.

UP NEXT

RHP Logan Webb (10-3, 2.79) of the Giants and RHP Yu Darvish (8-10, 4.13) of the Padres are scheduled to start the series finale Wednesday afternoon.