Alex Gordon and Eric Hosmer talk about Johnny Cueto's impact on the team after defeating the Astros to return to the ALCS. (0:50)

KANSAS CITY, Mo. -- Johnny Cueto knew the Kansas City Royals had wagered much of their future on him, trading away a bevy of prospects in late July so that he could pitch in moments like this.

The decisive game of a playoff series, their season on the line.

He responded with a masterpiece on his biggest stage yet, eight dominant innings Wednesday night that allowed the resilient Royals to rally once more for a 7-2 victory over the Houston Astros that sent them back to the American League Championship Series.

"I woke up today on the right foot," Cueto said. "As soon as I woke up, I felt something magic, that this was Game 5 and I had to show up for everybody, for this team and the fans."

Cueto allowed two hits, a single by Evan Gattis followed by Luis Valbuena's second-inning homer, before retiring the final 19 batters he faced. He struck out eight without a walk in the kind of clutch performance the Royals expected when they got him from the Reds.

When Wade Davis breezed through the ninth, the Royals poured onto the field to celebrate.

"Johnny Cueto was unbelievable," Royals manager Ned Yost said. "He knew the magnitude of this game. I think we all did. And he came out from the first pitch and had everything going."

The defending AL champs will host the Toronto Blue Jays in Game 1 on Friday night. The teams have met once before in the ALCS with the Royals winning in seven games in 1985 -- they would go on to beat the St. Louis Cardinals for their only World Series triumph.

"They're a great team," Davis said. "It'll be a fun series to watch."

The Royals trailed the Astros 2-1 in the fifth when Alex Rios led another comeback with a go-ahead, two-run double. Eric Hosmer and Ben Zobrist also drove in runs, and Kendrys Morales capped the festive night with a three-run homer off Dallas Keuchel in the eighth to put it away.

Collin McHugh (1-1), who won the divisional series opener for Houston, allowed three runs in four-plus innings. His bullpen fared little better just two days after it blew a four-run, eighth-inning lead to send the series back to Kauffman Stadium for Game 5.

"The good version of Johnny Cueto is really tough," Astros manager A.J. Hinch said. "Hats off to him. He pitched a great game. ... We didn't scratch much off him."

Nothing, actually, after the second inning. And even that came thanks in part to a rare series of lapses by the Royals defense that briefly quieted a charged Kansas City crowd.

With two outs in the second, Gattis sent a slow hopper down the line that third baseman Mike Moustakas fielded cleanly. But with plenty of time, his throw across the infield went wide, and first baseman Hosmer had the ball pop from his glove trying to make a swipe tag.

On the next pitch, Valbuena sent his two-run homer streaking into the Astros bullpen.

It wasn't until the fourth that Kansas City got a run back, on back-to-back singles by Cain and Hosmer. But by the fifth, the Royals had figured out McHugh's darting curveball.

Salvador Perez was hit by a pitch, and Alex Gordon hit a ground-rule double to right. Hinch brought in Mike Fiers in relief, and Rios sent a double bouncing down the chalk of the third-base line, scoring two runs and giving the Royals the lead.

Following a sacrifice bunt, Zobrist's lazy sacrifice fly made it 4-2.

That was plenty of support for Cueto, who was acquired from the Reds for a package of left-handed prospects just before the July 31 trade deadline precisely for moments like this.

Mixing quick-pitch fastballs with hesitation changeups, Cueto made the Astros look foolish most of the night. He jawed with Houston outfielder Carlos Gomez, strutted around like a Wild West gunfighter, and had the unmistakable swagger of an October ace.

After all, Cueto was finally proving that he was one.

"After the homer he settled in. He was able to use deception, quick-pitch, slow us down and disrupt our timing," Astros slugger George Springer said. "He's got electric stuff."

Cueto's star turn came after going 0-2 in his first four postseason starts, including a forgettable outing in Game 2 against Houston. He allowed four runs in six innings in that game, though Kansas City's offense and its stingy bullpen ultimately bailed him out.

There was no need for any help this time. Cueto was good enough on his own.

"Tonight was Cueto's night," Hinch said. "We didn't get a baserunner after the second, is that right? By my book. I thought the crowd got behind him, and he pitches with emotion. He rose to the occasion. This was his night."