Jamie Reed's late strike earned York victory over bottom-of-the-league Bath after both sides missed penalties.
York were handed an opportunity to take the lead on the stroke of half-time when they won a spot-kick but Jason Walker was unable to convert.
The visitors were awarded a penalty of their own 15 minutes from time but Ben Swallow missed.
Reed made them pay as he fired home with just two minutes left to give York their first win in four games.
York: Ingham, Parslow, McGurk, Fyfield, Meredith, Chambers (Reed 85), Kerr, Boucaud, Challinor (Henderson 69), Pilkington (Blair 74), Walker.
Subs Not Used: Smith, McLaughlin.
Goals: Reed 88.
Bath City: Garner, Simpson, Jones, Clough, Stonehouse, Watkins, Burnell, Swallow (Egan 85), Connolly, Canham, Phillips (Preece 79).
Subs Not Used: Matthews, Rollo, Cook.
Booked: Watkins, Clough.
Ref: Richard Clark (England)