ATLANTA — The Cardinals turned the diamond into a giant pinball machine, dinging hits all over SunTrust Park.

By the time the Braves finally got the third out, it was the most productive first inning in postseason history.

The Cardinals scored 10 runs their first time up and dealt Atlanta another playoff heartbreak, routing the Braves, 13-1, in decisive Game 5 of the NL Division Series on Wednesday.

“That was crazy,” said Marcell Ozuna, one of five players who batted twice in the stunning outburst. “We got a good opportunity — and we took it.”

Before many fans had reached their seats, the Cardinals were already booking their plans for the NL Championship Series, where they will face either the Dodgers or the Nationals in a best-of-seven set beginning Friday. Those teams were meeting in their own Game 5 at Dodger Stadium on Wednesday night.

It is St. Louis’ first NLCS trip since 2014.

“We know we can beat anyone at this point,” Kolten Wong said.

For the Braves, it might take a while to get over this debacle.

After pitching seven scoreless innings in a Game 2 win, Mike Foltynewicz retired only one hitter before getting yanked. First baseman Freddie Freeman booted a potential double-play ball that might have limited the damage. The Cardinals scored their final run of the inning on a strikeout — a wild pitch in the dirt that skipped away from catcher Brian McCann, who retired after the game.

“We just strung together a bunch of great at-bats,” Wong said.

It was Atlanta’s 10th straight postseason round loss since its last victory 18 long years ago, tying the ignominious mark set by the Cubs between 1908 and 2003.

Carrying on the tradition that started at Atlanta-Fulton County Stadium, moved on to Turner Field and is now becoming an annual occurrence at SunTrust Park, it was a visiting team that got to celebrate in the ATL.

The Cardinals broke out T-shirts and caps, hopped around in the middle of the infield and gathered on the pitcher’s mound for a team portrait with the center field video board looming as a backdrop.

For the 13th time in 21 postseason appearances since moving to Atlanta, the Braves finished the year with a loss on their home field.

“It was more of a shock than anything,” said Josh Donaldson, whose homer provided the lone Atlanta run. “You don’t expect something like that to happen, especially with how well we played all season.”

The Cardinals batted around and got more than halfway through their order a second time before the Braves even came to the plate.

Tommy Edman, Dexter Fowler and Wong all had two-run doubles as St. Louis equaled the highest-scoring inning in postseason history, a record set by the Philadelphia Athletics against the Cubs in the 1929 World Series. It was matched by the Tigers (1968 World Series vs. St. Louis), the Angels (2002 ALCS vs. Minnesota) and, now, the Cardinals.

No team had ever scored 10 runs in the very first inning of a postseason game. It was the first time the Braves franchise has allowed that many opening-inning runs in any game since they were in Boston on July 2, 1925, against the Brooklyn Robins.

The Cardinals made several changes after their 10-spot in what might’ve been the first set of defensive moves ever made by a team before its opponent had batted. There was no need to worry about any more offense with budding ace Jack Flaherty on the mound, coming off one of the great second halves by a starting pitcher in baseball history.

“We took the crowd out of it,” Fowler said. “We knew Folty would try to get ahead of us. We were trying to get some good pitches to hit. It was a little easier to see the ball today.”

Manager Mike Shildt let the 23-year-old Flaherty throw 104 pitches over six innings, surrendering four hits for the first postseason win of his blossoming career. Flaherty loaded the bases in the fifth after drilling Ronald Acuña Jr. with a fastball, but induced an inning-ending groundout from Freeman.

This one, though, will long be remembered for what happened before Flaherty even took the mound.

Foltynewicz, who didn’t walk anyone in Game 2, started ominously with a walk to Fowler. Wong followed with a sacrifice bunt — the only hitter Foltynewicz retired.

Paul Goldschmidt reached on an infield hit, and the crowd stirred nervously when Marcell Ozuna lined another single to right to bring home the first run.

Then, the play that essentially finished off the Braves. Yadier Molina drilled a one-hopper to first that Freeman likely would’ve turned into an inning-ending double play if he made the scoop. Instead, everyone was safe when the ball deflected off his glove and rolled slowly toward second base to leave the bases loaded.

“This one is on me,” Freeman said.

Wong tagged and hustled to third on Goldschmidt’s lineout to right. Ozuna appeared to end the inning when he flailed at a ball in the dirt for strike three, but McCann couldn’t corral the wild pitch. The catcher fell down picking the ball up near the backstop and threw late to first from his backside while Wong sped home.

Matt Carpenter walked to force in a run and Edman ripped a two-run double to make it 4-0. After Paul DeJong was handed an intentional walk to re-load the bases, Atlanta manager Brian Snitker emerged from the dugout to call in 17-game winner Max Fried.

Flaherty drew another bases-loaded walk and Fowler lined a two-run double down the left-field line to make it 7-0. Wong followed with yet another two-run double, pushing the score to a staggering 9-0.