All the goals came in the second half after the home side took the lead on 53 minutes from the penalty spot. Gary McDonald was brought down in the box and Richard Brodie stepped up to beat Michael Ingham despite the keeper getting a good hand to the effort.
The Shrimps' lead lasted just four minutes as York hit back from a set piece. Lanre Oyebanjo floated a free-kick to the far post, the ball was knocked back across the goal and York skipper Chris Smith ran in to head past Barry Roche from eight yards out.
Morecambe regained the lead 17 minutes from time when Stewart Drummond volleyed home an Andy Fleming left-wing corner, but the home side's hopes of a rare home win were ended by Ashley Chambers' late strike when he volleyed past Roche from close range after the keeper had only parried the striker's close-range header.