It was a far from convincing display by the former Championship leaders, but maintains their challenge for a top two finish after Featherstone’s shock home loss to Swinton.
Halifax had a try disallowed inside a minute, York-born Ross Divorty being pulled back for a knock on, but the home side hit the front soon after when prop Andy Bracek crossed after clever play from hooker Paul Handforth.
Full back Lee Paterson kicked the conversion, but the 6-0 lead lasted less than five minutes, York’s former Featherstone hooker Jack Lee twisting over from close range and full back Tom Carr converting.
The Knights then took the lead when centre Jack Latus touched down in the corner, although Carr’s missed conversion left them only 10-6 ahead.
The home side restored their lead through loose forward Craig Ashall, Paterson kicking the goal for a 12-10 interval lead at the end of a scrappy 40 minutes.
Visiting stand-off Ben Johnston produced a classy solo score three minutes after the restart, Carr kicking York 16-12 ahead.
That was the score that finally snapped the home side out of their lethargy, with a Rikki Sheriffe touchdown in the 52nd minute, goaled from the sideline by Paterson, putting them back in front at 18-16.
That was how it stayed until the end as Halifax finally assumed a measure of control, although Carr missed a penalty for the Knights inside the last 10 minutes.
Halifax: Paterson; Worrincy, Sheriffe, Heaton, Reittie; Murrell, Thackeray; Ambler, Handforth, Bracek, Manning, Divorty, C Ashall. Substitutes: Tonks, K Ashall, Adamson, Casey
York: Carr; Elliott, S Latus, J Latus, Browne; Johnston, Presley; Potter, Lee, Aldous, Scott, Mallinder, Picketts. Substitutes: Brining, Lyons, Bell, Stenchion
Referee: George Stokes (RFL).