Forest Green Rovers replaced York at the National League summit with victory in the top-of-the-table clash at The New Lawn.
Second-half goals from Harvey Bunker and Kyle McAllister preserved Forest Green's unbeaten home record this season and saw York lose for the first time in 13 league matches.
York, on a four-game winning run, went close in the third minute when Dipo Akinyemi forced home goalkeeper Jed Ward into a smart low save.
Forest Green were then inches away from taking the lead in the opening stages of the second half, with Joe Quigley hitting his effort against the far post.
Bunker broke the deadlock in the 64th minute as he found the top corner after York failed to clear and McAllister added a second with seven minutes left with a finish via the upright.
Match report supplied by PA Media.