The Cardinals’ Daniel Descalso, left, is congratulated by Kolten Wong as he crosses home plate to score on a sacrifice fly by Matt Carpenter in the 12th inning of Saturday game against the Philadelphia Phillies.

PHILADELPHIA — Matt Carpenter hit a sacrifice fly in the 12th inning, lifting the St. Louis Cardinals over the Philadelphia Phillies 6-5 on Saturday night.

Jhonny Peralta homered for the Cardinals, who have won eight of 10 and closed within a half-game of NL Central-leading Milwaukee.

Ryan Howard homered and Marlon Byrd and Carlos Ruiz each drove in a pair of runs for the Phillies.

The teams combined to use 14 pitchers in a game that took 4 hours, 53 minutes.

The Phillies tied it at 5 in the eighth on Byrd’s two-run single off Pat Neshek, who relieved Randy Choate after the bases were loaded with no outs.

Cardinals starter Shelby Miller was in line for the win after going six innings and allowing three runs and five hits.

A pair of Phillies errors helped the Cardinals break a 2-all tie and go in front in the sixth with three runs off reliever Mario Hollands.

After A.J. Pierzynski led off with a double, Oscar Taveras hit a sinking liner to left. Domonic Brown appeared to pull up on a catchable ball and Pierzynski took off for third when Brown hesitated to throw back to the infield. Brown then threw the ball away, allowing Pierzynski to score.

David Buchanan got his first no-decision in his 14th start, giving up two runs and eight hits in five innings.

The right-hander is filling in for Cliff Lee, who is out for the season with an elbow injury.

DODGERS 7, METS 4

LOS ANGELES — Adrian Gonzalez had the kind of game that has enabled him to drive in 100 or more runs six times in his big league career. And he’s closing in on another one.

The slugging first baseman tied a season best with five RBIs, including a go-ahead, three-run homer, and the Los Angeles Dodgers defeated the New York Mets 7-4 Saturday night.

“Adrian’s a day-in, day-out kind of grinder that picks up one, picks up two — and obviously tonight picks up five,” manager Don Mattingly said.

“He’s one of those guys who good at driving in runs with a guy on third and putting the ball in play when he needs to. As far as consistency, I don’t think we’ve had anybody quite like him,” he said.

The Dodgers beat the Mets for the 13th time in 15 meetings and increased their NL West lead over San Francisco to 4 1/2 games.

Zack Greinke (13-8) allowed four runs — three earned — and nine hits in seven innings, throwing 105 pitches on seven days’ rest. He struck out four after he was pushed back two days because of elbow discomfort.

“I’m sure it helped some,” Greinke said. “I thought I pitched really well. I felt great again today. And so hopefully that’s how it stays. It was just kind of a weird circumstance that gave me extra time this turn.”

The 2009 AL Cy Young Award winner allowed two homers for the third time this season, a three-run shot by Juan Lagares and Lucas Duda’s 24th of the year.

Kenley Jansen pitched a scoreless ninth for his 37th save.

Jacob deGrom (6-6) gave up five runs and five hits over six innings and struck out seven after getting reinstated from the disabled list. The rookie right-hander, who was sidelined with rotator cuff tendinitis, threw 86 pitches and also had two hits in his first start since Aug. 7.

Gonzalez, who leads the Dodgers with 87 RBIs, gave them a 5-3 lead in the fifth with his 18th homer after Greinke singled and deGrom walked Carl Crawford with two outs. The Dodgers hit three homers against deGrom in a 4-3 road win on May 21, but he has yielded just two in 75 1-3 innings over his last 12 outings.

“I felt good. But a lot of outings come down to a few pitches, and I didn’t make the big pitches when I needed to,” deGrom said.

Lagares opened the scoring in the fourth with his third homer after Duda singled and Travis d’Arnaud reached on a fielding error by third baseman Miguel Rojas. Gonzalez got one of the runs back in the bottom half with an RBI single and added a sacrifice fly in the seventh.

Mets All-Star third baseman David Wright was 0 for 5 with two double-play grounders and two strikeouts, lowering his average to .265. The franchise’s all-time leader in a number of key offensive categories is batting just .206 over his last 26 games with four RBIs and 19 strikeouts, and has grounded into 21 double plays.

Manager Terry Collins isn’t ready to give him a day off.

“I don’t think the stars need that stuff. They’ve got to figure it out on the field,” Collins said. “This guy is the leader on this team, and we need him out there. But in my time here, I haven’t seen him scuffle like he has this year. In my daily conversations with him, he’s not hurt. He’s healthy. But I certainly don’t have an answer to why he’s going through what he’s gone through.”

Daniel Murphy had a pair of singles, raising his NL-leading hit total to 157.

TRAINER’S ROOM

Mets: Injuries have hurt the Mets this season. They are 60-70 and 15 games out in the NL East. “I don’t think about stuff like that too much, because all teams deal with them,” Collins said. “You’ve got to play through it. I mean, we lost Matt (Harvey), and that’s a big piece. He would have made a big difference. But he wasn’t here, and somebody else had to step up. You never want injuries — but in our case, there are some things we got out of it that we wouldn’t have otherwise. If Matt didn’t get hurt, maybe we wouldn’t have found deGrom. Who knows? So we’ve found some positives.”

Dodgers: CF Yasiel Puig, batting .247 this month with no homers and four RBIs in 83 at-bats, got the night off because his legs were bothering him. “I knew he was getting beat up and he said he was tired, so we thought today was the right day,” Mattingly said.

UP NEXT

Mets: Bartolo Colon (11-10, 3.85 ERA) will make his first start Sunday since his mother, Adriana, died Monday at age 63 from breast cancer. After the game, he will return to the Dominican Republic to attend her funeral.

Dodgers: Kevin Correia (7-13, 4.87) gets the assignment on his 34th birthday, trying to win his third straight start since Los Angeles acquired him from Minnesota. Correia hasn’t faced the Mets since Sept. 27, 2012, with Pittsburgh, when R.A. Dickey beat him for the 20th victory of the knuckleballer’s Cy Young Award season.