James Shields recovered from a shaky start Tuesday night and beat his former club when the Royals finally found some offensive punch in the late innings for an 8-2 victory over the Tampa Bay Rays at Kauffman Stadium.

It was an emotional night for Shields, who spent 12 years in the Rays’ organization before coming to the Royals in a transformative offseason trade.

“The guys had my back,” he said. “They always do. That's what this team's all about. We're real resilient. After a couple of losses, we fought back hard tonight.

“I've said it before — we've got a lot of character on this team. I knew I had to grind it out. I knew (Alex) Cobb was on the other side doing his thing. He's pitched well all year long. I just kept us in the game.”

Shields opened the game by surrendering a checked-swing single and a booming homer but yielded nothing further in his seven innings before handing a 7-2 lead to Kelvin Herrera.

“That shows he’s a veteran pitcher who knows how to pitch,” first baseman Eric Hosmer said. “It real easy to get rattled right there when you’re facing your old team.

“They start off with a two-run homer, but he leaves the guy on third base with less than two outs. He came back to the dugout and told us to get some hits, that they’re staying right there. And that’s what he did.”

Those two early runs, however, looked bigger and bigger as the Royals struggled to solve Tampa Bay starter Cobb. They finally did so by erupting for four two-out runs in the sixth inning.

It’s no small thing, either, that Hosmer started the rally with a double, and Mike Moustakas crushed a two-run homer that provided the Royals with a 3-2 lead.

“That’s what I was most excited about,” said Moustakas, who had not hit a homer in 129 previous at-bats dating to Sept. 14, 2012.

“Not that I hit a homer, but that I gave us the lead. Anytime you’ve got a lead with Jamie Shields in the game, and with the bullpen we’ve got, it’s almost automatic that we get a W.”