Two second-half goals ensured York maintained their play-off push with victory at Alfreton.
York almost went ahead after the break but Jamie Reed, who had been brought down in the box by Darran Kempson, saw his penalty saved by Jon Stewart.
The Minstermen took the lead midway through the second half when Matty Blair fired home from inside the area.
Lanre Oyebanjo sealed York's win, converting Patrick McLaughlan's cross into the box.
VIEWS FROM THE DRESSING ROOM
Alfreton manager Nicky Law told BBC Radio Derby:
"No complaints there, we were beaten by the better team. I think if you look at the team sheet before the game, you can see the quality they've got.
"We didn't set about the game in the way we normally do. I'm not making excuses but we did look tired. Emotionally and physically, the last eight, nine, ten games, the players have given their all and they should be proud of their efforts.
"If you go back two months, who would have thought we'd be in this position now? I don't think many people. We've come against a quality side who've got a lot of strength and depth and today we weren't good enough and we have to be honest about that."
York City manager Gary Mills told BBC Radio York:
"I thought from start to finish today we dominated the game.
"We played more like ourselves and I think it's been a while since we played like that.
"Just for a split second you know, Jamie Reed misses a penalty and then we miss two or three other chances in the second half and you think 'is it going to be?'
"And then as he does, Matty Blair comes in with another goal to sort of get us going, but thoroughly deserved and a big win for us."
Sorry, we were unable to load match stats, please try again.
Live Text Commentary
Full Time The referee blows for the end of the match.90:00 +2:28 Substitution
Substitution Matthew Blinkhorn comes on in place of Jamie Reed.90:00 +1:09
Foul by Nathan Jarman on James Meredith, free kick awarded. Direct free kick taken by Michael Ingham.90:00 +0:18
Jon Challinor gives away a free kick for an unfair challenge on Jake Moult. Direct free kick taken by Darran Kempson.86:10 Substitution
Substitution Jon Challinor comes on in place of Danny Pilkington.84:54
The ball is delivered by Nathan Jarman, Jamal Fyfield makes a clearance.83:03
Jamal Fyfield gives away a free kick for an unfair challenge on Danny Meadows. Direct free kick taken by Darran Kempson.80:39 Substitution
Substitution Jamie Mullan leaves the field to be replaced by Danny Meadows.80:07 Substitution
Substitution Chris Smith leaves the field to be replaced by Jamal Fyfield.75:55 Goal scored
Goal! - Lanre Oyebanjo - Alfreton 0 - 2 York Lanre Oyebanjo gets on the score sheet with a goal from inside the penalty area to the bottom right corner of the goal. Alfreton Town 0-2 York.75:11
Free kick awarded for a foul by Jake Moult on Patrick McLaughlin. Free kick taken by James Meredith.73:51 Substitution
Substitution Nicky Deverdics on for Josh Law.72:03
Adriano Moke produces a cross.70:59
Outswinging corner taken by Jamie Mullan from the right by-line played to the near post, Adriano Moke manages to make a clearance.68:50 Goal scored
Goal! - Matty Blair - Alfreton 0 - 1 York Matty Blair finds the back of the net with a goal from inside the box to the bottom right corner of the goal. Alfreton Town 0-1 York.67:57
Effort from outside the penalty box by Danny Pilkington goes wide right of the goal.67:36
Corner taken right-footed by Danny Pilkington from the right by-line, Theo Streete makes a clearance.67:20
Shot from just outside the box by Adriano Moke goes over the bar.64:10
Centre by Danny Pilkington.62:28
Daniel Parslow fouled by Adam Cunnington, the ref awards a free kick. Chris Smith restarts play with the free kick.
Jamie Reed takes a shot. Blocked by Theo Streete.58:37
Adam Cunnington takes a shot. Chris Doig gets a block in.58:01
The ball is crossed by Jamie Mullan, Chris Smith makes a clearance.56:36
Nathan Jarman takes a shot. Blocked by Lanre Oyebanjo.55:32
The ball is swung over by Daniel Parslow, clearance made by Darran Kempson.55:00
Inswinging corner taken by Danny Pilkington.53:48
Free kick awarded for an unfair challenge on Anthony Wilson by Chris Smith. Josh Law restarts play with the free kick.53:10
Nathan Jarman delivers the ball, save made by Michael Ingham.52:35 Substitution
Substitution Seamus Conneely leaves the field to be replaced by Nathan Jarman.52:19
Headed effort from deep inside the area by Chris Smith misses to the right of the target.51:46
Outswinging corner taken by Danny Pilkington from the right by-line, Anthony Wilson makes a clearance.51:18
Outswinging corner taken right-footed by Danny Pilkington played to the near post, clearance by Seamus Conneely.49:23
Jamie Reed takes a shot. Theo Streete gets a block in. Danny Pilkington takes a outswinging corner from the right by-line played to the near post, Anton Brown makes a clearance.48:23
Darran Kempson fouled by Jamie Reed, the ref awards a free kick. Jon Stewart takes the free kick.47:47 Penalty
A save by Jon Stewart from penalty by Jamie Reed. Alfreton Town 0-0 York.46:41
Foul by Darran Kempson on Jamie Reed, Penalty awarded.45:48
Seamus Conneely crosses the ball.45:01
The second half kicks off.45:00 +1:07 Half time
Half Time The referee blows for half time.43:22
Jamie Reed challenges Anton Brown unfairly and gives away a free kick. Darran Kempson restarts play with the free kick.42:53
Free kick awarded for an unfair challenge on Anthony Wilson by Chris Smith. Anton Brown takes the free kick.41:31
Corner from right by-line taken by Josh Law.41:02
Chris Smith gives away a free kick for an unfair challenge on Adam Cunnington. Josh Law restarts play with the free kick.40:18
Patrick McLaughlin has an effort at goal from long range that misses to the right of the target.39:58
The offside flag is raised against Anthony Wilson. Michael Ingham takes the indirect free kick.38:57
Patrick McLaughlin takes a shot. Save made by Jon Stewart.36:30
Adam Cunnington challenges James Meredith unfairly and gives away a free kick. Direct free kick taken by Danny Pilkington.36:14
Lanre Oyebanjo takes a shot. Blocked by Jon Stewart.35:20
The referee blows for offside against Jamie Mullan. Free kick taken by Michael Ingham.28:56
The referee blows for offside against Adriano Moke. Jon Stewart takes the indirect free kick.28:17
The official flags Jamie Reed offside. Theo Streete takes the indirect free kick.27:55
Anthony Wilson takes a shot. Blocked by Michael Ingham.26:30
Jamie Reed is caught offside. Indirect free kick taken by Jon Stewart.24:19
Jamie Reed has an effort at goal from close range which goes wide right of the goal.23:57
Short corner worked by Danny Pilkington.23:12
Josh Law gives away a free kick for an unfair challenge on Patrick McLaughlin. Free kick taken by Danny Pilkington.21:40
Jamie Mullan has an effort at goal from outside the box which goes wide right of the target.20:57
Inswinging corner taken right-footed by Josh Law from the left by-line to the near post.19:59
Patrick McLaughlin produces a cross.19:33
Matty Blair delivers the ball, clearance by Theo Streete.19:07
Danny Pilkington sends in a cross, Theo Streete makes a clearance.17:29
Foul by Jake Moult on Patrick McLaughlin, free kick awarded. Direct free kick taken by Michael Ingham.17:05
Free kick awarded for a foul by Jamie Reed on Theo Streete. Theo Streete takes the free kick.16:01
Corner taken by Josh Law.14:34
Corner taken right-footed by Danny Pilkington from the left by-line, clearance made by Theo Streete.13:38
The ball is swung over by Matty Blair.12:03
Danny Pilkington takes a shot. Jon Stewart makes a save.9:38
Matty Blair produces a left-footed shot from just outside the area that bounces off the post.7:48
Effort from deep inside the area by Danny Pilkington misses to the right of the goal.6:39
Danny Pilkington produces a cross, Theo Streete manages to make a clearance.5:32
Patrick McLaughlin takes a shot. Jon Stewart makes a save.5:22
The ball is sent over by Jamie Reed, Theo Streete manages to make a clearance.1:03
Effort on goal by Danny Pilkington from just inside the penalty area goes harmlessly over the target. Corner taken by Danny Pilkington, Seamus Conneely manages to make a clearance.0:00
The match begins.
Live data and text provided by our data suppliers