The Shrimps had seen Craig King squander a chance for the home side before Jim Bentley’s players took a 20th minute lead.
Ben Hedley released Jason Oswell down the right-hand side before sending the ball across goal for Adam Campbell to score.
Rhys Oates saw a header well saved before Alfreton equalised on 32 minutes when Aaron Wildig gave away a free-kick and King’s set-piece was headed home by Luke Shiels.
Alfreton took the lead eight minutes later when Tom Denton headed in from James Clifton’s cross.
Both sides made changes after the break with Morecambe drawing level on 54 minutes as Campbell and Wildig linked up with the former scoring his second of the night.
Alfreton keeper Tom Nicholson made a double save from Alex Kenyon and Lamin Jagne, while Barry Roche tipped over Declan Bacon’s effort.
Morecambe new boy Liam Mandeville saw a penalty saved before the winner came on 89 minutes when Jagne’s shot was saved but Carlos Mendes Gomes netted the rebound.