Morecambe condemned York to their first home defeat of the Conference season. The visitors led 2-0 at the break after Michael Twiss tucked the ball home and Garry Thompson producing a neat finish into the top corner of the net.
But Martin Woolford's goal reduced the deficit and Clayton Donaldson made it 2-2 with a penalty after David Perkins had fouled Mark Convery.
But within seconds Twiss's claimed his second, shooting into the bottom corner to restore Morecambe's lead.
York: Reid, Craddock, McGurk, Dudgeon (Parslow 78), Peat (Lloyd 45), Convery, Bishop, Panther (McMahon 53), Woolford, Donaldson, Farrell.
Subs Not Used: Webster, Rhodes.
Booked: Panther, Peat, McMahon.
Goals: Woolford 49, Donaldson 75 pen.
Morecambe: Drench, Yates, Blackburn, Brannan, Perkins, Thompson, Craig Stanley, Hunter, Curtis (Howard 78), Twiss, Carlton (McLachlan 85).
Subs Not Used: Davies, Meadowcroft, David McNiven.
Booked: Yates, Brannan, Craig Stanley, Perkins.
Goals: Twiss 20, Thompson 40, Twiss 75.
Att: 2,233
Ref: K Evans (Lancashire).