York climbed off the foot of the National League with an impressive win to leave Eastleigh still chasing their first win of the year.
In a hectic opening quarter-of-an-hour, City took charge with two goals from Jon Parkin.
Sean Newton’s long seventh-minute throw-in was headed on by Vadaine Oliver for Parkin to volley home at the far post, and the striker then finished off a similar move with another close-range finish six minutes later.
York keeper Kyle Letheren had a moment to forget when he failed to deal with Ross Stearn’s simple in-swinging free-kick and allowed the ball to bounce between his legs into the back of the net.
After the break, Spitfires defender Gavin Hoyte somehow cleared Amari Morgan-Smith’s close-range shot off the line.
Substitute Tyler Garratt then hit the post at the other end with a bouncing 25-yard drive.
Oliver nearly restored York’s two-goal lead when his header from an Asa Hall corner was pushed against the bar by keeper Ryan Clarke.
But the striker was not to be denied as he wrapped up the points with 10 minutes left, holding off Ayo Obileye’s challenge before steering a shot into the bottom corner.