NEW YORK — They could only keep the Royals down for so long.

Matt Harvey shut out the Kansas City club for eight innings on Sunday night in Game 5 of the World Series, and looked apt to send the teams west for Games 6 and 7. But Harvey came out to pitch the ninth and promptly walked Lorenzo Cain. Eric Hosmer followed with a double, scoring Cain, then advanced to third on a Mike Moustakas groundout to first.

What came next will live forever in World Series history, and in the hearts of Royals fans: When Salvador Perez grounded to Mets third baseman David Wright, Hosmer held at third then took off for the plate as soon as Wright threw the ball to first.

Replays would later show that a good throw from first baseman Lucas Duda would likely have nailed Hosmer at the plate for a game-ending double play. But Duda did not make a good throw, firing one to the backstop behind catcher Travis d’Arnaud to allow Hosmer to slide home safely.

Three innings later, the Royals rallied again on a series of base hits and Mets miscues to open up a 7-2 lead. Closer Wade Davis mowed down the Mets in the bottom half of the 12th to give the Kansas City franchise its second world championship, and its first since 1985.

The ninth inning seems to embody the 2015 Kansas City Royals almost too perfectly: Though many quibbled with the process behind Hosmer’s mad dash to the plate, there’s no arguing with the results. That’s about how it went all year for Ned Yost and his club, a team that reached the World Series just last year but still had to defy preseason expectations to win 95 games in the regular season.

And the game-tying run on Sunday was borne of battling through every at bat, putting the ball in play, and running like hell, which was pretty much the Royals’ whole thing all season. People doubted the formula at the start, and doubted it when the playoffs came around, just as they doubted Hosmer for running home in the ninth when he did. And none of it matters now.

Here’s what does: It worked. The Kansas City Royals are your 2015 world champions.