WREXHAM piled the pressure on former manager Gary Mills.
Mills, sacked as Reds’ boss in October following the poor start to the season, saw his York side lose a vital game in their bid to avoid relegation.
Dean Keates has led Wrexham away from the drop zone before embarking on a seven game run without success, but the Reds finally got back to winning ways at Bootham Crescent.
Wrexham had taken just two points from a possible 21 since their last win at Braintree on March 4 and this was the ideal response.
It looked like the barren run would continue after York scored with just 75 seconds gone, but Wrexham came more into the game.
Jordan White levelled before the break and with the game developing into an end to end and open contest, both teams had chances.
But White, finding some form during the run-in, made it 2-1 with his fourth goal in three games and substitute Leo Smith wrapped up the points with his first senior goal in added time.
Victory meant a lot to the near-900 travelling Wrexham fans, who vented their frustrations on Mills throughout.
Wrexham had to dig in against a York side who had won four of their previous five games and are only out of the bottom four on goal difference, but it was a win to savour in the end after the disappointing sequence of results.