The St. Louis Cardinals needed Michael Wacha to play stopper and the 22-year-old rookie needed help.

A sacrifice fly from Matt Carpenter, a couple of Red Sox errors and Carlos Beltran’s first World Series RBI was enough.

The Cardinals trailed when Wacha came out after six innings but scored three runs in the seventh Thursday night to beat the Red Sox 4-2 in Game 2 of the World Series.

The best-of-seven series is tied 1-1 with Game 3 set for Saturday in St. Louis.

Wacha (1-0) got his fourth win in four postseason starts despite giving up a two-run homer to David Ortiz in the sixth inning that gave Boston a 2-1 lead.

In the seventh, Craig Breslow came in for John Lackey after the Boston starter gave up a one-out walk to David Freese and a single to Jon Jay. After a double steal, Daniel Descalso’s walk loaded the bases.

Jonny Gomes’ throw home on Carpenter’s sac fly was wide to the first base side and got past Jarrod Saltalamacchia. Breslow, backing up his play, then threw high to third base trying to get Jay, who scored on the play’s second error to give the Cardinals a 4-2 lead.

“It was uncharacteristic of the way we’ve taken care of the ball this year,” said Red Sox manager John Farrell.

Beltran got his first two career World Series hits, including an RBI single in the seventh that made it 4-2.

Carlos Martinez threw a 1-2-3 seventh inning and pitched out of a jam with runners at first and second in the eighth for St. Louis. Trevor Rosenthal then struck out three in a perfect ninth to wrap up the win.

The Red Sox, after coasting to an 8-1 win in Game 1, had a franchise-record nine-game World Series winning streak snapped. They had won their last six World Series home games prior to Thursday.

Boston’s Jake Peavy will pitch against St. Louis’ Joe Kelly in Game 3.

Wacha, the right-handed phenom who was MVP of the NLCS after outdueling LA’s Clayton Kershaw twice, struck out six, walked four and gave up three hits.

“The kid continues to impress,” said Cardinals manager Mike Matheny. “I don’t know what else you could ask. Put him on any stage and he does a real nice job of limiting distractions. … He stuck with his strengths and really went out and was aggressive, and that’s exactly what we needed him to do.”

Wacha said his nerves weren’t “too bad” before his first World Series start but he was anxious to take the mound.

“It’s the World Series, a big-time game,” he said. “So I just tried to use it to my advantage to go out and pitch with some adrenaline, and just try to block out the fans and the crowd.”

Matt Holliday tripled and scored on Yadier Molina’s infield chopper in the fourth inning for St. Louis’ first run.

Beltran was in the lineup after leaving Game 1 with a rib injury he suffered when he ran into the wall to take a grand slam away from Ortiz in the second inning. He led the team with two hits and the Cardinals snapped a four-game losing streak in World Series Game 2s.

“Tomorrow I know for sure I’m going to wake up feeling sore,” said Beltran. “Basically they gave me an injection to kind of block the pain for five or six hours. I know for sure tomorrow I’m going to feel sore.

“The good thing is tomorrow I have the day off, and I’ve got the opportunity to get treatment, and hopefully Saturday I feel better than what I feel today.”

Lackey (0-1) took the loss in his first World Series start since winning Game 7 as a rookie for the Angels in 2002. He was charged with three runs on five hits and two walks in 6 1/3 innings. He struck out six.

Freese’s walk and Jay’s single knocked him out of the game and Descalso put together a seven-pitch at-bat against Breslow to draw the walk. Carpenter’s flare to left field wasn’t deep but Gomes’ throw wasn’t accurate.

Saltalamacchia was in position to stop it, but let it get past him. Breslow, despite there being two outs, went right for third on his throw but sailed it past the bag.

Beltran lined his RBI single to shallow right field on a 3-1 pitch for the 4-2 lead.

Martinez, another 22-year-old rookie right-hander, got a little help when Pete Kozma, who pinch-ran for Freese and stayed in to play shortstop, bare-handed Stephen Drew’s grounder across the middle in the reliever’s 1-2-3 seventh.

Jacoby Ellsbury’s leadoff bouncer in the eighth ate up Carpenter at second for an error and Ortiz beat the shift with a two-out single. But Martinez got Mike Napoli on a pop-up behind short to escape the inning.

Earlier, Holliday tripled off the low center field wall in the fourth inning — the first runner to make it past first base. Pedroia dove to snare Matt Adams’ liner for the first out, but Holliday made it home on Molina’s slow infield chopper.

It was the first lead for the Cardinals in their last six World Series games against the Red Sox, but Wacha couldn’t make it last through six.

Ortiz hit his 17th career postseason home run into the first row of seats on top of Fenway Park’s Green Monster, scoring Pedroia after a one-out walk in the sixth. It was Ortiz’s second home run in the series and fifth during the 2013 playoffs.