CHICAGO — When Aaron Hicks slid across home plate, ahead of an errant throw from Chicago Cubs shortstop Addison Russell, he was tugged at by competing emotions.

“I was exhausted, but excited,” Hicks said after the Yankees outlasted the Cubs, 5-4, in an 18-inning marathon that began Sunday night, concluded Monday morning and took six hours and five minutes to complete.

As the Yankees showered, scarfed down their postgame meals and prepared to head to Cincinnati, where they were due to play in about 17 hours, the consensus seemed to be that if you were going to play a game this long, you had better win it.

To do so, the Yankees had to survive a lot.

Aroldis Chapman, who on Friday received the World Series ring he won with the Cubs, had another Game 7 moment — blowing a three-run lead and watching his team rally to win. Starlin Castro was hitless in eight at-bats, but his ground ball to short with one out in the 18th inning — off his good friend Pedro Strop — was good enough to get Hicks home from third base ahead of Russell’s errant throw.