Northampton 0-2 York
Northampton's 10-match winning run at Sixfields was ended by struggling York, who moved three points clear of the drop zone.
Ashley Chambers fired in from 10 yards to put the Minstermen in front.
York keeper Michael Ingham made a string of saves before John Johnson turned Matty Blair's cross into his own net to make it 2-0.
It ended a winning streak that began on 22 December and dented the promotion hopes of Aidy Boothroyd's Cobblers.
Northampton are sixth in League Two, five points behind third-placed Burton, while one win from their remaining three games will guarantee a play-off place.
VIEW FROM THE DRESSING ROOM
Northampton Town manager Aidy Boothroyd tells BBC Radio Northampton:
"We got what we deserved. We didn't play the conditions particularly well in the first half and they scored at a key time.
"The expectation level goes right up. Some of the players try too hard.
"We made daft decisions defensively and offensively. The pressure was on us and we didn't deal with it very well today.
"We will do all we can to get automatic promotion and if not, we'll do our best to get out of this league. Simple as that. But today was a reality check."
York City manager Nigel Worthington told BBC Radio York:
"We knew we had to perform because Northampton's form at home has been exceptional throughout the season.
"We knew we had to certainly go and deal with them and then go and play when we got the opportunity and I though the players that were out there were outstanding.
"It was good that we carried out what we worked on and we deserved the result. Credit to the lads."