Accrington slumped to their fourth successive League Two defeat thanks to a late goal from York's Jason Walker.
Matty Blair went close from 20 yards and Walker's effort was blocked by George Miller as the visitors made the early running.
Clarke Carlisle had an effort saved on the line by keeper Ian Dunbavin, while Padraig Amond sent a header wide for the hosts at the other end.
But Walker won it with seven minutes left when he finished a scrappy move.
VIEWS FROM THE DRESSING ROOM
York City manager Gary Mills told BBC Radio York:
"I said after the game on Saturday we deserved the win and we deserved it again tonight.
"We had to battle hard, they work hard, they pressure hard and we had to be patient.
"Before we got the goal we had chances to take the lead but it doesn't get any better than that for me.
"You win at home then win 1-0 away. It's the perfect result."
Sorry, we were unable to load match stats, please try again.