Match ends, York City 1, Cheltenham Town 0.
York defender Dave Winfield's second-half header was enough to beat League Two relegation rivals Cheltenham.
Michael Coulson hit the Cheltenham post with a free-kick and Stephane Zubar's header was cleared off the line by Matt Richards before York went ahead.
Centre-half Winfield rose highest to meet Luke Summerfield's 73rd-minute far-post corner from four yards.
That leaves City five points clear of danger, but ruined new Cheltenham boss Gary Johnson's first game in charge.
Cheltenham remain bottom, three points adrift of safety with six games left.
Shaun Harrad wasted their best chance just before the half-hour mark following Craig Braham-Barrett's left-wing cross.
The on-loan Notts County striker's downward header from four yards lacked the power to beat home goalkeeper Michael Ingham, recalled as Bobby Olejnik was suspended.
York City manager Russ Wilcox told BBC Radio York:
"Nervous moments at the end, but I think over the 90 minutes we deserved the win.
"I thought the lads were really brave. I asked the lads to be brave with the ball today and we moved it around the pitch and created opportunities.
"It was just a massive team effort and I mean everybody at the football club not just the players.
"It was a massive six pointer and we were on the right end of that."
Cheltenham Town manager Gary Johnson told BBC Radio Gloucestershire:
"Apart from a spell in the second half, I thought the effort was there, that's the first thing you've got to have in your group.
"They're gutted in there and I've tried to pick them up, that's why I had a bit of a go at them at the end there on the pitch in front of the fans - not for effect, but I don't want people thinking we're out of it and that we're relegated, of course we're not, there's six games left yet.
"I know it's disappointing for the Cheltenham fans to come all the way here and see their team lose again, but hopefully they've seen a little modicum of hope - in as much as that we were probably one goal away from having a decent performance.
"I am passionate about keeping this club in the division."
- 5McCombeSubstituted forZubarat 45'minutesBooked at 78mins
- 18PlattSubstituted forMillerat 69'minutes
- 30CoulthirstSubstituted forO'Hanlonat 90+4'minutes
- 28McDonaldSubstituted forHaynesat 74'minutes
- 6MillsBooked at 53minsSubstituted forHanksat 69'minutes
- 29HarradSubstituted forMansetat 74'minutes
- Kevin Wright
- Shots on Target
Second Half ends, York City 1, Cheltenham Town 0.
Substitution, York City. Josh O'Hanlon replaces Shaquile Coulthirst.
Attempt missed. Danny Haynes (Cheltenham Town) right footed shot from the right side of the box is close, but misses to the right.
Attempt saved. Shaquile Coulthirst (York City) left footed shot from outside the box is saved in the bottom left corner.
Foul by Dave Winfield (York City).
Mathieu Manset (Cheltenham Town) wins a free kick in the defensive half.
Foul by Brad Halliday (York City).
Danny Haynes (Cheltenham Town) wins a free kick on the right wing.
Attempt missed. Mathieu Manset (Cheltenham Town) header from the centre of the box is just a bit too high following a set piece situation.
Stéphane Zubar (York City) is shown the yellow card.
Foul by Stéphane Zubar (York City).
Lee Vaughan (Cheltenham Town) wins a free kick in the defensive half.
Foul by Brad Halliday (York City).
Mathieu Manset (Cheltenham Town) wins a free kick on the right wing.
Hand ball by Jake Hyde (York City).
Substitution, Cheltenham Town. Danny Haynes replaces Shaquille McDonald.
Substitution, Cheltenham Town. Mathieu Manset replaces Shaun Harrad.
Goal! York City 1, Cheltenham Town 0. Dave Winfield (York City) header from very close range to the top left corner. Assisted by Luke Summerfield with a cross following a corner.
Corner, York City. Conceded by Craig Braham-Barrett.