It took a hearts-in-their-throats, game-ending double play with the bases loaded to seal the deal, but the Braves finally beat the Dodgers, and played the kind of game they will need to play a lot more down the stretch if they’re to get where they hope to go.

After Ervin Santana pitched six strong innings and two relievers pitched eight strong innings, and after Andrelton Simmons drove in a pair of runs and Justin Upton put the Braves ahead, Craig Kimbrel pulled off another precarious ninth-inning escape to secure a thrilling, 3-2 win against the Dodgers at Turner Field.

Matt Kemp grounded into a 4-6-3 double play with the bases loaded to end the game, and Kimbrel pumped his arms and showed about as much emotion as he’s ever shown after the final out.

“It’s not a situation I wanted to put our team in, but I was happy we were able to work out of it,” said Kimbrel, who gave up a leadoff walk, a bunt single and a two-out single before recording his 35th save and allowing the Braves and a crowd of 33,299 to breathe again. “It’s a situation you never want to get yourself into. Any time you have to rely on a double-play ball to get out of an inning in the game, you’re not at a good spot.

“So hopefully next time I go out there I go 1-2-3, and make it a lot more easy and a lot less stressful,” Kimbrel added.

Santana struck out nine in six strong innings to extend two personal winning streaks and help the Braves snap their skid against the Dodgers. The win was just the third in 14 games for the Braves, who had scored a total of 13 runs in five losses against the Dodgers during that span.

“I’m happy I helped out a little today,” said Simmons, who had missed six starts with a sprained ankle. “Everybody battled. Santana battled. Kimbrel didn’t look like he was feeling good at first, but he battled through and we came out victorious, so it was a great game.”

Kimbrel made things interesting in the ninth, walking pinch-hitter Andre Ethier before Dee Gordon’s bunt single. struck out Yasiel Puig – the outfielder’s fourth strikeout – before Adrian Gonzalez singled to left field. Justin Upton fielded it nicely on the short hop, but threw to second base instead of third, where they had a chance to get Ethier, who had hesitated between the bases.

“I’m sure the fan at home is wondering why didn’t he throw the ball to third base,” said Braves manager Fredi Gonzalez, who lauded Upton for just making the stop. “That ball could have easily been at the warning track. That’s a tough, sinking line drive that he short hopped and he’s got his head down and he probably never saw the runner, Ethier going from second to third. He’ s just looking to second. That was a great play just to keep that ball in front of him.”

Upton said, “Late in the game if it gets past you that could cost you the game, so I was trying to be aggressive. I came after the ball, I was able to catch it on the hop. It kind of (stinks) I didn’t get an out there, but it kept the (lead) at one and let Craig get a chance to get a ground ball.”

When Kimbrel induced the game-ending double play, Gonzalez said from his own reaction in the dugout, people might have thought the Braves had won Game 7 of the World Series. It was that kind of an ending for a team that badly needed a win like this — or any win, for that matter.

“When (Kimbrel) walked Ethier there, I’m going, bunt’s going to turn into a base hit or maybe even turn into a ball that’s going to be thrown down the right-field line because (Gordon) is so fast,” Gonzalez said. “But Craig … the moment doesn’t get away from him. I think maybe that’s just maturity. He’s been in those situations closing big games. He doesn’t get rattled a lot. After he got one out you felt pretty good that we were going to get out of it. Not real good, but pretty good.”

Santana (12-6) won his fifth consecutive decision and sixth consecutive home start, allowing eight hits, two runs and two walks in six innings and improving to 7-1 in his past nine starts, including 5-0 with a 2.70 ERA in his past six.

He won a duel with Dodgers left-hander Hyun-Jin Ryu (13-6), who gave up three runs, six hits and two walks in 5 2/3 innings before leaving the game with a gluteus muscle strain.

“For me, I’m just trying to be simple and throw strikes and just trust my team,” Santana said. “I know we’ve been rough for a little bit but at the same time we just have to trust our teammates and know that we are going to be good…. We just have to keep it positive and come here and score runs.”

The Braves improved to 3-3 on their 10-game homestand and can salvage a split of their four-game series with the Dodgers by winning Thursday afternoon’s finale, before the American League West-leading Athletics come to town.

Simmons, after missing six starts with a sprained ankle, drove in a run with a groundout in his first at-bat, and singled in the tying run his next time up in the fourth inning.

After striking out 99 times in their past nine games, including 23 times in the first two games of this series, Braves hitters tried some small ball in the second inning – and it worked. After Evan Gattis lined a double over the head of center fielder Puig to start the inning, Johnson laid down a sacrifice bunt for just the third time in his career and second this season.

His other sacrifice this season came in extra innings, and Johnson made the decision to bunt Wednesday on his own, despite having a league-leading .432 average against lefties.

“We had to get something going,” he said. “With a leadoff double we can’t afford to let that guy not score. I took a hack at the first (pitch), gave myself an opportunity and then once he got a strike on me I was doing whatever I could to get the guy to third base. I know I’ve got good numbers off lefties, but I felt like we needed that run, no matter what happens.

“We couldn’t afford, after them scoring two runs and after the way it’s been going, we couldn’t afford to let a leadoff double go to waste. And I had all the confidence in the world that Andrelton was going to get him in.”

Simmons’ grounder to second base trimmed the Dodgers’ lead to 2-1.

The Braves tied it with a run in the fourth on an Upton walk and a pair of two-out singles by Johnson and Simmons, who reached out to get a 1-0 changeup off the plate and poked it to right field.

The Braves, who’ve had considerable difficulty scoring runs without home runs, were on a run-manufacturing roll now and kept it going in the fifth when they scored without benefit of an extra-base hit. Jason Heyward had a one-out single and Freddie Freeman was hit by a pitch before Upton hit a two-out, opposite-field single through the right side for a 3-2 lead.

“All of our wins are going to be important for us going down the stretch,” Upton said. “But to do it the way we did — C.J. giving himself up early in the game so we could try to respond to their two-run lead, the little things. There’s going to be times we face good pitching like Ryu tonight and we’re going to have to fight and battle, and that’s what we did tonight. It was a hard-fought win and we did a great job.”

Santana improved to 6-0 with a 2.66 ERA in his past six home starts, and began in dominant fashion by striking out the side – Dee Gordon, Puig, Adrian Gonzalez — in the first inning on 14 pitches. Puig struck out in all three plate appearances against Santana.

It was a matchup of two of the National League’s hottest pitchers, as Ryu entered with a 4-0 record and 1.91 ERA in his past five starts. The left-hander has been one of the league’s top road pitchers in 2014, with a 9-2 record and 2.61 ERA in before Wednesday.

On the other hand, Santana has done his best work at home, going 8-2 in 11 home starts before Wednesday and bringing that five-start home winning streak into his matchup with Ryu and a Dodgers team that’s dominated the Braves going back to their division series in October.

After no Dodger could touch him in the first inning, Santana didn’t miss many bats in the second. He gave up three consecutive hits to start the inning including Kemp’s leadoff double off the wall and Carl Crawford’s RBI single. Santana induced a double-play grounder by A.J. Ellis, but No. 8 hitter Miguel Rojas singled to drive in another run for a 2-0 lead.

Ryu followed with a two-out single, the fourth hit by a Dodgers starting pitcher in three games. Santana got out of the inning without further damage when Gordon grounded out to strand two runners. And then, he switched back to highly effective mode.

Santana struck out two in a perfect third inning and got Ryu to ground out with two runners on to end the fourth, after allowing a two-out double by A.J. Ellis and walking Rojas. He gave up a leadoff single to Gordon in the fifth, but struck out Kemp with Gordon at third base to end the inning.