The Minstermen have got off to an unconvincing start to the National League North season.
On Saturday they drew 1-1 at home to Curzon Ashton but had already beaten Stockport County and Ashton United.
"York City Football Club has today parted company with manager Martin Gray," confirmed a club statement.
"The club has informed Martin that his contract will not be renewed and he has now left his post with immediate effect.
"The club's Board of Directors would like to thank Martin for his services and wishes him all the best for the future.
"The Board of Directors provided Martin with all the necessary financial support to rebuild his squad this summer after the team had missed out on last season's promotion play-offs.
"Regrettably, it is felt that a change is now needed.
"Assistant-manager Sean Gregan is also leaving with immediate effect and the board thanks him for his services and wishes him all the best for the future."