Substitute Ryan Fallowfield scored the pick of the goals as York twice came from behind to secure a 4-2 National League victory over lowly Morecambe.
The home side started brightly but fell behind when Miguel Azeez scored from the penalty spot in the 23rd minute.
York might have been level on the half-hour but Ollie Pearce saw his header from Ollie Banks’ cross come back off the crossbar.
They did get themselves back into it with four minutes of the half remaining when Malachi Fagan-Walcott scored at the far post.
Morecambe regained the lead four minutes after the restart when Ben Tollitt slotted home Mo Sangare’s pass, but Banks blasted the Minstermen back on level terms with half-an-hour remaining.
Alex Hunt’s 66th-minute strike and Fallowfield’s sumptuous volley either side of Azeez’s stoppage-time red card earned York a fourth successive win.