Alex Hunt's stoppage-time penalty earned York a dramatic win over Dagenham and Redbridge.
Hunt struck for the 10-man Minstermen, who had Ollie Pearce sent off late on, to restart their pursuit of leaders Barnet.
City lost to Boston last time out and left it until the 43rd minute to go in front here, Tyrese Sinclair nodding in at the back post.
Josh Umerah headed the Daggers level six minutes after the break and it looked as though it would stay that way until Hunt kept his nerve at the death.
York are six points shy of Barnet with two games in hand.
Report supplied by PA Media.