Martyn Woolford was the two-goal hero, finishing off two clinical moves involving strikers Craig Farrell and Clayton Donaldson, the latter frightening the life out of the Woking defence who were left chasing shadows in the opening 45 minutes.
Typically, Woking battled back well in the second half and, sparked by Jon Nurse's goal, they stormed back into the match without creating anything clear-cut until the final moments when substitute Steve Ferguson put a Craig McAllister flick-on over the crossbar.
Perhaps Woking will feel they might have snatched their customary late goal but, backing themselves to bounce back from conceding twice - as they had at Altrincham four days earlier - proved too much to ask.
York arrived at Kingfield having won three out of four away games, amazingly all by the odd goal.
With the Cards having won four out of their five past matches, it made for an intriguing evening's football.
Simon Jackson, recalled to the Woking starting line-up for the first time in five games, was lucky not to get sent off in the opening minutes for deliberately hauling down City's flying winger Woolford.
Arguably the last man, Jackson got away with a yellow card in what was a frenetic opening with both sides trying to impose themselves on proceedings.
As the half wore on, it was York who began to dominate with some slick passing football that had Woking back-pedaling and reduced to knocking the ball aimlessly.
City got their reward after 28 minutes when they sprung a superb move instigated by Farrell. His incisive pass sent Donaldson away and the striker burst into the penalty area on the right, cut inside Danny Bunce, before setting up Woolford, who stabbed home from close range via a post.
Cue total football from the visitors, who snatched the initiative and continued to buzz around the Woking box before snatching a second.
York had lost Dave McGurk with a head injury and Woking's Neil Smith was soon to follow with a nasty gash above his right eye.
By the time Ollie Berquez had replaced Smith, York had doubled their lead.
Farrell and Donaldson were again the architects. Farrell's pass sending Donaldson away again, his wonderful run ended with a simple side-footed pass across the box to the unmarked Woolford who took a touch, before smashing the ball past Shwan Jalal.
York were fully deserving of their 2-0 half-time lead and Woking will have received a severe talking to from boss Glenn Cockerill whose side had been made to look second best.
That all changed after the break when Nurse gave them a 54th minute lifeline. From a free-flowing move involving six passes, the first real passage of play Woking had put together, Bunce's cross was not cleared and Nurse slid the loose ball past keeper Tom Evans.
The goal sparked a furious onslaught from the hosts and suddenly they were back in the game with City under pressure for the first time.
The visitors weathered the storm though and they brought on midfielder Mark Convery and took off striker Farrell as they made their intentions clear.
Woking huffed and puffed without creating anything clear-cut until Ferguson had that late chance for glory which passed him by.