Malachi Fagan-Walcott and Ollie Pearce struck in stoppage time as York came from behind to snatch a 2-1 win at Halifax.
Jamie Cooke had put the hosts ahead after 14 minutes, cutting on to his right foot before lashing home from the edge of the box.
Florent Hoti had chances to double Halifax’s lead but was twice denied by City keeper Harrison Male.
Instead Fagan-Walcott scored in the first minute of stoppage time from a corner and Pearce headed in a dramatic winner six minutes into stoppage time.