The Kansas City Royals beat the Oakland Athletics 9-8 in a thrilling, 12-inning do-or-die Wild Card playoff on Tuesday. It was the Royals' first postseason appearance in 29 years.

Salvador Perez, who had twice failed to drive in runners on third base earlier in the game, pulled a two-out base hit past diving third baseman Josh Donaldson to score Christian Colon and end a nearly five-hour battle.

Colon, whose infield single scored Eric Hosmer with the tying run, had reached second by recording the seventh stolen base for a fleet-footed Royals team that had rallied in the bottom of the ninth to force extra innings.

"This is the craziest game I ever played," said Hosmer, who began the winning rally with a one-out triple high off the wall in left-center.

"No one believed in us before the game. No one believed in us before the season."

The action-packed victory in the one-game showdown that launched MLB's postseason sent Kansas City to a best-of-five AL Divisional Series against the Angels starting in Los Angeles on Thursday.

The National League Wild-Card playoff is set for Wednesday between the visiting San Francisco Giants and the Pittsburgh Pirates.

MOSS MASHES

Oakland slugger Brandon Moss had powered the A's to a 7-3 lead with a pair of home runs and five runs batted in, but the Royals closed the gap with a three-run rally in the eighth.

The Royals, dead last in the major leagues with 95 home runs, stole four bases in the inning and had runners on second and third with one out before A's reliever Luke Gregerson struck out Perez and Omar Infante to end the threat. Kansas City tied it in the ninth using their speed to build another rally.

Pinch-hitting slugger Josh Willingham led off with a bloop single and pinch-runner Jarrod Dyson was bunted over to second.

Dyson stole third base in a daring dash and scored on a long sacrifice fly by Norichika Aoki off Oakland closer Sean Doolittle that ignited thundering roars from home fans decked out in Royal blue.

ROLLER-COASTER RIDE

The A's looked like they were back in charge when pinch-hitter Alberto Callaspo singled home Josh Reddick for an 8-7 lead in the top of the 12th but the Royals had other ideas.

Oakland A's manager Bob Melvin was stunned by the sudden turnaround.

"How am I feeling? I'm not feeling very good," Melvin said to reporters. "It was a great game. Both teams played well and played hard. (But) We want to win the game."

The A's used six pitchers and Kansas City used seven, while the teams combined to field 28 position players in the marathon.

After Moss's home run barrage, the Royals trailed 7-3 in the sixth.

"It's a battle, we're battling for our season," said Hosmer. "This team showed a lot of character tonight. It was a roller-coaster ride, just kept going back and forth, and back and forth."

Oakland starter Jon Lester struggled to explain the loss.

"That's a tough one," said Lester. "It's a weird game. You don't see games like that in the playoffs too often.

"Unfortunately, we were on the bad end of that one."