ST. LOUIS -

The St. Louis Cardinals did something on Saturday they hadn't done all season: Walk off with a win.

Jon Jay scored from first base on Shane Robinson's pinch single and a throwing error by Giancarlo Stanton of the Miami Marlins with two out in the ninth inning, giving the Cardinals a 5-4 win at sold-out Busch Stadium.

Edward Mujica (1-1) worked a 1-2-3 ninth for the win, while A.J. Ramos (3-3) was victimized by Stanton's mistake as St. Louis (52-34) won its first series since taking three of four from the Chicago Cubs on June 17-20.

Jay worked a walk and Robinson slapped a single to right on a full-count pitch. Jay reached third easily, and when Stanton's throw bounced off first baseman Logan Morrison's glove, Jay scored standing up.

"It looked like he was caught deciding whether to throw the ball to second or first," Robinson said of Stanton. "I'm an outfielder and when you're in that spot, when you think about it, that's when that type of play will happen.

"You don't want to overthrow the (cutoff man). He might have short-armed the ball to Logan and maybe I distracted (Morrison) by rounding first. When I saw the ball get away, I turned my head and Jon was already running home. It was a great read."

Many thought Cardinals manager Mike Matheny would turn to National League batting leader Yadier Molina instead of Robinson. But Matheny revealed after the game that Molina was unavailable because he was undergoing an MRI exam on his right knee.

The club is optimistic that Molina's injury isn't a long-term deal.

"Every time someone doesn't feel good, I have fear," Matheny said.

While it wasn't the classic walk-off win, Matheny was glad for any kind of victory against the Marlins (32-54), who entered the series with the National League's best record since May 31 at 19-12.

"I don't think it was strange," Matheny said. "Jon with the two-out walk, Shane battled to a full count and got a hit ... just goes to show what happens when guys keep taking tough at-bats."

Matt Adams gave St. Louis a chance for its dramatic ending when he wiped out the Marlins' 4-2 lead in the bottom of the seventh with a two-run home run to right-center field, his seventh of the season.

It was the second pinch home run for Adams, who jumped on a meaty 1-and-2 fastball down the middle from reliever Mike Dunn. Adams said regular at-bats during the Cardinals' recent eight-game trip through the American League West kept him sharp for this appearance.

"I've been playing lately, so it's easier to stay in a groove," Adams said. "But pinch-hitting, no matter when you do it, is tough. I just stay ready for a fastball in any count and I got one to hit."

Miami established a 3-0 lead after 2 1/2 innings. Rookie shortstop Adeiny Hechavarria blooped an RBI single to center in the top of the second and Morrison lined a two-run home run into the Marlins' bullpen in left-center in the third.

St. Louis responded with two runs in its half of the third when Matt Carpenter laced an RBI triple to center, then trotted home on Carlos Beltran's single up the middle.

Miami made it 4-2 in the fourth on Derek Dietrich's leadoff home run and appeared to add another run later in the inning. But Hechavarria, trying to score from third on Nathan Eovaldi's bouncer to second, was called out even though Tony Cruz's tag appeared to be late.

Marlins first-year manager Mike Redmond argued at length with plate umpire Bill Welke and was ejected for the second time this season. It was the second straight game in which Miami got the short end of a call by the plate umpire.

In Friday night's 4-1 Cardinals win, plate umpire Fieldin Culbreth ruled that Jacob Turner's fifth inning bunt was fair, despite replays showing it spun foul before it was fielded by Molina. St. Louis turned it into a double play, ending a scoring threat.

NOTES: Manager Mike Matheny will tinker with his rotation next week, moving Adam Wainwright ahead of Shelby Miller to start the Tuesday night series opener against Houston. This will also allow Wainwright to pitch Sunday night in Chicago, the team's final game before the All-Star break, but will keep Wainwright from pitching in the All-Star Game. Wainwright was consulted about the switch and gave his assent. ... The move also gives the Cardinals a chance to buy a little extra rest for Miller, who will start on Wednesday. His next start after that could be held back until July 24 because of the All-Star break. ... Miami LF Justin Ruggiano has hit 12 home runs this season, all away from spacious Marlins Park. That ties him with six players for the most consecutive road homers to start a year, including former Marlin Derrek Lee (2000).