Spratt, 21, featured in Man United's youth system before their Under-18s set up.
He has also played for Huddersfield Under-23s before joining York in 2019.
Manager Michael Clegg said: “Harry has a great background for such a young age. Two things stood out with Harry, one was just how well he played for York against us last season. When we analysed the game after, we were very impressed.
"We knew he wasn't starting regular so it was one to chase up in the summer. The second was how refreshing the conversation was when we met. He just wants to play football and progress, he is desperate to do well. He will be a big asset this season.”
Keep up-to-date with our exclusive email newsletters.
Subscribe