York reached the FA Cup second round for the first time since 2010 as captain Lenell John-Lewis bagged a brace to see off Chester.
Visiting skipper George Glendon reduced the deficit for the National League North side, but it is the Minstermen who now go on to entertain 2013 Cup winners Wigan in a televised game on Friday, 1 December.
York started with purpose as Dipo Akinyemi fired past the near post just six seconds into the contest before John-Lewis opened the scoring in the fifth minute.
Poor away defending saw John-Lewis afforded the space to collect Scott Burgess' right-wing corner at the near post before turning and firing past an exposed Will Stanway from two yards.
Chester only managed one effort during the opening 45 minutes, with David Stockdale keeping out a diagonal Adam Thomas drive.
After the break, ex-York midfielder Elliott Whitehouse stabbed wide of a gaping goal following a goalmouth scramble.
But the Minstermen doubled their advantage midway through the second period when Stanway misjudged a bouncing ball, leaving John-Lewis with an empty net to grab his second goal of the night.
The visitors rallied, though, with Declan Weeks forcing a fine save from Stockdale before Glendon went on to grab his team's consolation, beating the ex-Fulham keeper with a composed 10-yard finish after 71 minutes.
Report supplied by PA Media.