York scored twice in the final five minutes to secure a 2-1 win at fellow National League strugglers Dagenham.
The Daggers pushed hard for a breakthrough in the first half, with Charley Kendall shooting wide, Josh Rees firing over and Ryan Whitley tipping Ryan Hill’s curling effort over the crossbar.
Substitute Lenell John-Lewis volleyed wide for York, but Dagenham found the breakthrough on the hour mark when Hill smashed home from Lewis Page’s cutback.
However, John-Lewis fired past Dagenham goalkeeper Elliot Justham in the 85th minute before Dipo Akinyemi’s seventh goal of the season won it for the Minstermen at the death.