York boss Nigel Worthington was clearly mightily relieved after his side secured a 1-0 win at Dagenham to guarantee League Two survival.
The hosts also survived - on goal difference only - thanks to Barnet's 2-0 defeat at Northampton.
Chris Smith scored the only goal of a tense game in the second half.
Wearing a big smile, a delighted Worthington said: "It's been such a tough week for everyone so I'm just delighted we've managed to come here and get the win we desperately needed.
"I have to admit there have been nerves around the place, but we managed to just about keep a lid on it and we're finally safe now.
"We can go away and take a bit of a breather, and then thankfully we can then start working towards another season in the Football League.
"Everyone has worked so, so hard and so that has all paid off handsomely.
"There's so much that goes on behind the scenes that people aren't always aware of. The efforts of everyone involved all year had to come down to this moment, and we've done enough.
"The fans can go away and relax for a while too. They've been superb for us all season and they deserve this moment too.
"It's such a relief, and I'm kind of happy that it's all over now. Roll on next season."