Gregory Polanco capped another late rally, driving in Jung Ho Kang with two outs in the 10th inning to lift the Pirates to a 6-5 victory over the Cardinals on Sunday night.

St. Louis took a 5-3 lead in the top of the 10th on a two-run double by Randal Grichuk off Arquimedes Caminero (1-1). Pittsburgh, which won in 14 innings on a homer by Andrew McCutchen on Saturday, did it again 24 hours later against St. Louis All-Star closer Trevor Rosenthal (1-2).

Starling Marte brought Pittsburgh within a run with an RBI single. Francisco Cervelli tied it with a single and Polanco followed two batters later with a looper to right that sent Kang streaking across the plate and the rest of the Pirates streaming out of the dugout after their second walkoff win in two nights.

"The way we came together at the end, kept our nose down, kept grinding at-bats, just looking for that big hit," shortstop Jordy Mercer said. "We kept it going and the last two nights were amazing, a lot of fun."

Pittsburgh took three of four from St. Louis to pull within 2 ½ games of the Cardinals heading to the All-Star break. Rosenthal blew a save for only the second time this season.

"That was Trevor coming at him with the best stuff he had tonight," St. Louis manager Mike Matheny said. "He's been worked hard. It's not the same when you've been worked that hard."

Rosenthal threw 27 pitches while working 1 1-3 innings during Saturday's marathon and was on his 29th pitch Sunday when Polanco delivered the first walkoff of his career.

"They're hard ones to swallow," Matheny said. "You have very few chances where you can put a game away. Had a few chances yesterday and again today."

McCutchen's career-best, 18-game hitting streak ended but his teammates picked him up and brought the streaking Pirates — who trailed St. Louis by nine games on May 8 — within striking distance with 74 games to go.

Pittsburgh Pirates' Gregory Polanco, right, scores on a hit by starting pitcher Francisco Liriano ahead of the tag of St. Louis Cardinals catcher Yadier Molina in the second inning of a baseball game, Sunday, July 12, 2015, in Pittsburgh. (AP Photo/Keith Srakocic)

"It was a big series for us to be able to scratch out some wins against a great club," Mercer said. "They're the top and we know that."

A night after the Pirates rallied three times to stun St. Louis, they did it again with a bunch of role players chipping in while McCutchen went 0 for 5. Mercer and Cervelli each had two hits and eight of Pittsburgh's nine starters had at least one.

Grichuk had three and Jhonny Peralta had three hits apiece for St. Louis but the Cardinals went just 1 for 11 with runners in scoring position.

Still, St. Louis came within an out of a series split.

Pittsburgh's normally reliable setup man Tony Watson came on in the eighth trying to preserve a 3-2 lead but struggled. Watson hit Kolten Wong with a pitch to start the inning, gave up a single to Peralta and loaded the bases when Mercer couldn't handle a chopper by Jason Heyward. Wong tied it on a fielders' choice by Yadier Molina, though Watson avoided further trouble by striking out Peter Bourjos with the bases loaded.

It stayed tied until the 10th when St. Louis went to work against Caminero. Grichuk delivered the big blow, a double to the gap in right-center. Mercer threw out Mark Reynolds as he tried to score from first on the play, a decision that would prove costly minutes later for the Cardinals.

"You don't realize it at the time but it's a big play," Mercer said. "It helped us out."

TRAINER'S ROOM

Cardinals: LF Matt Holliday hit some shag balls before Sunday night's game. He will sit out Tuesday's All-Star game to give his injured quadriceps a little more rest but should be ready to play for the first time since June 8 when St. Louis opens the second half on Friday against the New York Mets.

Pirates: 1B Corey Hart had a setback in one of his knees while rehabbing a hip impingement and has been shut down. General manager Neal Huntington said Hart will rejoin the team in Pittsburgh and have the knee re-evaluated. Hart has been out since June 21.

UP NEXT

Cardinals: St. Louis will send five players to Tuesday's All-Star game in Cincinnati: pitchers Carlos Martinez, Michael Wacha and Rosenthal, as well as Molina and Peralta before beginning the second half of the season at home on Friday against the New York Mets. Lance Lynn (6-5, 2.90) will get the start. Lynn is 1-3 with a 3.42 ERA in six games against the Mets.

Pirates: Pittsburgh sends Gerrit Cole, whose 13 wins lead the majors, A.J. Burnett and Melancon to Cincinnati, as well as McCutchen. The team begins the second half on Friday at Milwaukee when Charlie Morton (6-2, 4.15 ERA) gets the start. Pittsburgh is 133-152 after the break under manager Clint Hurdle.

Think your friends should see this? Share it with them!

Story copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.

Feedback, Corrections and Other Requests: AP welcomes feedback and comments from readers. Send an email to info@ap.org and it will be forwarded to the appropriate editor or reporter.