The Miami Marlins took advantage of an error by the Kansas City Royals to score the go-ahead runs in the seventh inning Wednesday then turned to their bullpen to wrap up a 5-2 victory.

The Royals were leading 2-1 when Koyie Hill doubled off reliever Tim Collins (2-6) to start the seventh. Christian Yelich then hit a grounder toward third that utility man Elliot Johnson let through his legs putting runners on second and third with nobody out.

Donovan Solano and Logan Morrison followed with RBI groundouts to give the Marlins the lead.

That was enough for the Marlins bullpen. Dan Jennings (2-3) got through the sixth A.J. Ramos worked the seventh and eighth and Steve Cishek handled the ninth for his 26th save.

Cishek struck out Alex Gordon with runners on first and second to end the game.

Solano and Morrison each finished with a pair of RBIs for Miami. Justin Ruggiano went 3 for 4 and drove in a run ending his franchise-worst 0-for-42 skid with his single in the second.

The Royals were rolling when the series began. They'd won 17 of 20 after taking the opener to climb into playoff contention but now limp off to play five games in four days against AL Central-leading Detroit with their first defeat in eight series.

The Marlins meanwhile head home after a long road trip with two consecutive wins.

The Royals blanked 1-0 in 10 innings Tuesday night got off to a good start when Eric Hosmer doubled in the first inning and eventually scored on a single by Salvador Perez.

The Royals failed to take advantage of the erratic Jacob Turner though. The Marlins starter walked six without a strikeout in five-plus innings but Kansas City could only squeeze out one more run against him on a groundout by David Lough in the fourth.