KANSAS CITY, Mo. -- Matt Carpenter had a career-high five hits for St. Louis on Wednesday night.
The last of them was arguably the most important.
Carpenter delivered a go-ahead double in the 11th inning, and the Cardinals added two more runs on a single by Allen Craig, sending them to a 5-2 victory over the Kansas City Royals and ending a frustrating three-game losing streak.
"Sometimes it takes an emotional victory like this to kind of jumpstart a team," said Carpenter, who also reached base on a walk. "Maybe this one will be the one for us."
The Royals rallied with two runs in the ninth, and the game remained tied until the 11th, when Peter Bourjos worked a one-out walk off Royals reliever Kelvin Herrera (1-2). Carpenter then rapped his double to center field, drawing a roar from a crowd comprised mostly of Cardinals fans.
Sam Freeman (1-0) earned the win with a perfect 10th inning.
"It was just one of those gut-check games," Craig said. "We're not going to stop competing."
Carpenter became the first Cardinal to record five hits in a game since Ryan Ludwick on Sept. 4, 2009. He had a part in his club's first three runs, driving in Mark Ellis in the second inning and scoring on Matt Holliday's groundout in the seventh
After St. Louis dropped the first two games of the four-game, two-city set at Busch Stadium, the NL champs rebounded to win for the eighth straight time at Kauffman Stadium.
The Cardinals persevered after Adam Wainwright blew a 2-0 lead in the ninth inning. He struck out Eric Hosmer to start it, but the ball squirted away from catcher Yadier Molina, allowing Hosmer to reach first base. Billy Butler followed with a crisp single up the middle.
Trevor Rosenthal, who took the loss Tuesday night, entered in relief and walked Alex Gordon on a full count to load the bases. Salvador Perez followed with a broken-bat groundout to score a run, and Lorenzo Cain's single up the middle knotted the game 2-all.
"You lose the lead and a start like that from Waino, there's a lot of teams that will roll over in that situation," Cardinals manager Mike Matheny said, "but the guys stepped up."
The ninth-inning rally still soured a dazzling outing by Wainwright, who was trying to become the NL's first nine-game winner. The two-time All-Star did not allow a hit until the sixth inning, stranded three runners on third base and struck out eight while walking just two.
"Wainwright pitched a great game. He's an unbelievable pitcher," Cain said. "When we tied the game, I thought we had them. We tried to spoil it for him at the end."
Wainwright wasn't the only Cardinal to get on track, though.
Molina had hits in his first two at-bats, snapping an 0-for-16 streak. Ellis ended an 0-for-8 stretch with his single in the second that led to the game's first run.
Jason Vargas kept Kansas City in it most of the night. After leaving the bases loaded in the first inning, he went on strand 10 in a season-high eight innings. The left-hander allowed nine hits and walked two while allowing two runs or fewer for the fifth time in six starts.
"Carpenter was pretty hot," Vargas said. "It was just one of those games where you've got to grind, make pitches and kind of think your way through things."
Vargas threw a season-high 117 pitches. ... Royals RHP Greg Holland pitched a scoreless 10th, his 11th straight appearance without allowing a run. ... LHP Bruce Chen (bulging disc) said he will need at least two more rehab starts before rejoining the Royals. He allowed eight hits in three innings for Double-A Northwest Arkansas on Tuesday night. ... Cardinals 2B Kolten Wong was out of the lineup with a sore right shoulder. He pinch hit for Ellis in the 10th inning and remained in the game. ... RHP Michael Wacha starts for St. Louis in Thursday's series finale. RHP Yordano Ventura is on the mound for Kansas City.