A second-half strike from Dave Merris was enough to give York an unlikely victory against Exeter.
The Grecians dominated the game and created enough chances to win comfortably.
But a combination of poor finishing and some fine saves from York goalkeeper Chris Porter denied Exeter the chance of forcing their way into the play-off positions.
The Grecians looked lively in the opening stages and Gareth Sheldon tested the goalkeeper with a fierce drive from the edge of the box in the fourth minute.
Exeter should have taken the lead after dominating early on. Sheldon again tested the goalkeeper with a long-range effort before Sean Devine shot wide after he was put clean through on goal.
But for all their possession, Exeter were unable to force an opening.
After the break Devine struck a shot over the bar from the edge of the box and Sheldon's corner flew through a sea of players before the ball was hooked off the line.
Completely against the run of play York went ahead when Sheldon's sloppy back pass was intercepted by Paul Robinson, who rounded the goalkeeper before laying the ball to Merris to tap home from close range.
Sheldon almost made amends instantly when he curled a shot against the crossbar and Andy Taylor had a shot cleared off the line by Kevin Donovan.
York goalkeeper Porter stretched out a hand to superbly keep out Les Afful's fine shot as Exeter chased the game.
Porter again saved well from Taylor as it increasingly looked like it wasn't going to be Exeter's night.
Substitute Marcus Martin went close with a header in the dying minutes but there was no way back for City.
For York it was an unlikely victory but one that could prove crucial as they battle for survival.