KANSAS CITY, Mo. — When the Houston Astros had recorded the final out in Yankee Stadium on Tuesday night, they flooded onto the field in a wild celebration, all their years of losing finally a memory.

It looked a whole lot like the scene in Kansas City a year ago.

Now, the long-suffering Astros will try to accomplish what the once-beleaguered Royals did by building on their wild-card victory over the Yankees. They visit Kansas City to begin a best-of-five AL Division Series against the Royals on Thursday night at Kauffman Stadium.

“It kind of reminds us of us last year,” Royals third baseman Mike Moustakas said after a light workout Wednesday afternoon, “young and hungry and out there trying to prove to everybody that we deserve to be here.”

The Royals certainly accomplished that 12 months ago.

After ending a 29-year postseason drought, the plucky bunch of youngsters swept all the way to the World Series, where they fell in seven games to the San Francisco Giants. But it was the Royals’ dramatic, extra-inning victory over the Oakland Athletics in their AL wild-card game that instilled in them a belief that they could play with anybody in baseball.

Much like Tuesday night in the Bronx seemed to galvanize the young Astros.

They clowned around before the first pitch, then took care of New York when it was time to get serious, before resuming their playful antics with a rousing 30-minute postgame party.

“You know, we did it in a little more dramatic fashion than they did,” Royals Manager Ned Yost said of the wild-card win, “but they played a very solid game, took advantage of mistakes, excellent pitching and defense. Both teams play with a lot of passion and energy.”

In other words, both teams have a whole lot of fun. And so apparently did the fans.

WITH THE YANKEES playing, baseball’s wild-card game drew its largest television audience in its short history.

The Houston Astros’ 3-0 win over New York in the AL wild-card game Tuesday night on ESPN averaged more than 7.6 million viewers.

The network said Wednesday that’s up 36 percent from the 5.6 million for last year’s NL game between the Giants and Pirates on ESPN, which was the previous high. It’s up 46 percent from the 5.2 million for the 2014 AL game between small-market Kansas City and Oakland on TBS.

Major League Baseball added the wild-card round in 2012.