As Justin Upton circled the bases on a three-run homer trot in the ninth inning, Braves closer Craig Kimbrel was warming up in the bullpen, ready to enter with a 7-3 lead against the Mets.

Victory seemed certain.

The Braves did win, but not without plenty of consternation when Kimbrel gave up two runs in the ninth inning of his first appearance in a week, then cursed after handing the ball to manager Fredi Gonzalez and walking off the mound with the bases loaded and two out.

The Braves won 7-5 at Citi Field, their seventh win in eight games. Ervin Santana pitched seven innings of one-run ball and Upton and Freddie Freeman had three hits apiece and four RBIs between them.

But the matter that had Braves fans abuzz on the Internet afterward was Kimbrel’s outing — after time off to rest a sore shoulder — and his exit.

“That was pretty bad. I was all over the place,” Kimbrel said of a 24-pitch performance in which he allowed three hits, two runs, one walk and hit a batter. “I couldn’t get the curveball over at first. Just throwing fastballs over the plate, and when you do that it makes for a tough inning.”

And his exit?

“I’m a competitor, and any time you get taken out obviously you get upset about it,”Kimbrel said. “And I did. I probably shouldn’t have acted like I did. It’s just one of those things, he (Gonzalez) is trying to protect me from throwing too many pitches. We still got the win, so that’s awesome.”

Jordan Walden came in and faced one batter, inducing a game-ending groundout by Travis d’Arnaud that required a strong throw by shortstop Andrelton Simmons from the back edge of the infield.

Minutes later, Kimbrel went to Gonzalez’s office to talk.

“I just went in and apologized to him,” Kimbrel said. “I mean, that’s disrespectful to him and to the team, and it’s just not the kind of person that I am, and I felt awful about it. So I wanted to make sure (he knew) that was just my competitiveness and my emotions.”

Gonzalez said Kimbrel’s reaction to being pulled with two outs was understandable, that it showed the competitive fire that is part of why he’s so successful.

“He came in here and we talked a little bit,” Gonzalez said. “He’s fine. Like all good athletes, they’re competitors, they want the ball. You’ve got to pry it out of their hands. He was terrific after (the game).”

And healthy. Ultimately, that’s all that mattered for the Braves and Kimbrel, who said his pitching shoulder was fine.

“It felt great, actually,” he said. “Maybe too good; I was having a hard time finding the strike zone. Come in tomorrow and hopefully it’s a situation I can get out there again.”

Gonzalez said he and pitching coach Roger McDowell had discussed a 23-25 pitch limit for Kimbrel in his first outing back after not pitching since the previous. Kimbrel hadn’t been told of that limit, but afterward said he understood.

Until the late-innings activity, including Braves reliever David Carpenter giving up two runs in the eighth inning, the game had been about Santana and Freeman. It’s a combination that might just be enough to cause Chipper-esque nightmares for the Mets, who can at least take some solace in the fact that Santana is only signed to a one-year contract.

They’ll have to deal for many more years with Freeman, whose double in the fifth pushed the Braves lead to 3-1. They added a run in the eighth when Upton scored on a wild pitch. It looked like that would be enough, but that was before Carpenter gave up four hits in the eighth, continuing a recent shaky run by Braves relievers.

Santana (2-0) kept doing what Braves starters have been doing, cranking out not just quality starts but dominant outings. He allowed six hits, one run and two walks with seven strikeouts in seven innings, the seventh consecutive game in which a Braves starter has allowed one or no runs.

Braves starters have a major league-leading 1.46 ERA and 14 quality starts. Santana (2-0) has an 0.86 ERA in his first three starts, including 2-0 with a 0.60 ERA in two against the Mets.

In three career starts against them, including one last season for Kansas City, he’s 3-0 with a 0.86 ERA.