York's hopes of automatic promotion from the National League were dealt a blow with a 2-1 defeat against Braintree.
City went into the weekend 11 points behind Barnet and knowing they could not afford any more slip-ups.
But they fell behind in the 25th minute as veteran John Akinde fired in from outside the box.
Josh Stones levelled from a corner in the 35th minute but Jermaine Francis came off the bench to win the match with virtually his first touch 24 minutes from time.
Match report supplied by PA Media