KANSAS CITY, Mo. - The Orioles had managed a measly 15 runs while losing six straight games, and were preparing to face Johnny Cueto and the streaking Kansas City Royals on Wednesday night.

Naturally, they pounded five homers in an explosive performance.

"It's why the people come to the games," Baltimore manager Buck Showalter said after an 8-5 victory. "Because what's supposed to happen on paper doesn't always happen."

For instance, Chris Davis breaks out of an 0-for-16 slump with a double and a two-run homer. Or Manny Machado, also struggling at the plate, hits his own two-run shot. Or Jonathan Schoop hits yet another two-run homer off Cueto, who struggled for the second consecutive start.

Wei-Yin Chen (8-6) allowed three runs for the Orioles while scattering nine hits over six innings. The losing pitcher against the Royals in Game 3 of last year's AL Championship Series, he has now gone seven straight starts without a defeat.

"Every day we come here to the ballpark, all we think about is how to win today's game," Chen said through a translator. "Hopefully we can move up from here."

Cueto (9-9) laboured through five innings for Kansas City, allowing 10 hits and a walk. He was coming off a career-high 13 hits in a loss to Boston.

"I'm not a robot," he said. "Just have to keep working, get ready for the next one."

Steve Pearce made it 7-3 with a solo shot in the eighth for Baltimore. Mike Moustakas kept the Royals close with a two-run homer off Brian Matusz in the bottom half of the inning, but Ryan Flaherty answered with the Orioles' fifth homer leading off the ninth.

Zach Britton got three outs for his 30th save.

The Orioles had lost nine straight to the Royals, and appeared to be in trouble again when they failed to score with runners on the corners and nobody out in the second inning.

In the bottom half, Moustakas hit a sacrifice fly and Salvador Perez an RBI double to stake Kansas City to a 2-0 advantage that could have been more substantial. The inning ended when Omar Infante ran past Paulo Orlando on a flyout, resulting in Infante also being called out.

Moments later, the Orioles started to showcase their power.

Baltimore tied the game in the third on Machado's two-run shot, then pulled ahead in the fourth when Schoop clobbered his two-run homer an estimated 427 feet to left field.

Davis made it three straight innings with a two-run shot when he went deep in the fifth, the big first baseman's 35th home run giving Baltimore a 6-2 advantage.

Kansas City clawed back with a run in the sixth when Kendrys Morales hit an RBI single, but Chen calmly retired Moustakas and Perez to prevent more damage.

When the Orioles tacked on a couple more home runs in the final two innings, the Royals were headed to only their third loss in 15 games at Kauffman Stadium.

"You're facing the best team in the American League last year and they've added players to improve on that," Showalter said. "So it's a challenge, but we've got a chance to split against the American League champions tomorrow and move on to Texas."

STATS AND STREAKS

The five home runs allowed by the Royals matched a season high. ... Royals RHP Jeremy Guthrie made his first relief appearance since June 30, 2012, when he was with the Rockies. He had been in the Kansas City rotation. ... Machado has 26 homers, the most by an Orioles third baseman since Melvin Mora hit 27 in 2005. ... Pearce's homer was his first since July 11.

TRAINER'S ROOM

Orioles: After another rough start Tuesday night, Showalter was asked whether RHP Miguel Gonzalez is fully recovered from a groin injury. "Yeah," Showalter replied. "Far as I know."

Royals: Manager Ned Yost has given reliever Ryan Madson and closer Greg Holland some rest due to sore arms, though Holland has been available the past two nights.

UP NEXT

Orioles: RHP Chris Tillman took a tough-luck loss in his last outing against Minnesota, but is 3-0 with a 2.50 ERA over his past six starts.

Royals: RHP Yordano Ventura allowed one run and six hits in a win last Saturday at Boston, making him 4-0 with a 3.55 ERA in his last six outings.