Forest Green replaced York at the National League summit after winning the top-of-the-table clash 2-0 at The New Lawn.
Second-half goals from Harvey Bunker and Kyle McAllister preserved their side’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.
Subscribe or register today to discover more from DonegalLive.ie
Buy the e-paper of the Donegal Democrat, Donegal People's Press, Donegal Post and Inish Times here for instant access to Donegal's premier news titles.
Keep up with the latest news from Donegal with our daily newsletter featuring the most important stories of the day delivered to your inbox every evening at 5pm.