The Blues were well off the pace before the break and trailed to strikes from Bradley Fewster and Lewis Alessandra.
A stunning effort from Luke Summerfield then gave the destined-to-be-relegated Minstermen a three-goal advantage.
Gareth Evans pulled one back as Pompey finally started to click and both sides might have added to the scoring as the game became extremely stretched.
Paul Cook made three changes from the side that were beaten at home by Plymouth at the weekend.
With Christian Burgess and Gary Roberts both nursing knocks, there were starts for Adam Webster and Marc McNulty.
The other switch saw Evans come in wide on right, with Adam McGurk dropping to the bench.
There was a comical moment in the opening stages when referee Nigel Miller awarded a Pompey goal-kick – despite the ball clearly striking Ben Davies on its way out of play.
But there was little else to cheer the large travelling support in a contest that the struggling hosts dominated.
There were a couple of half-chances early on, with Evans’ cross drifting onto the roof of the net and Webster heading wide from a corner.
But it was York looking the more threatening and Paul Jones did well to deny Fewster following a fine surging run from Luke Hendrie.
The keeper was called into action again on 25 minutes, this time preventing Summerfield from finding the net from a free-kick wide on the left.
And there was a further scare when McNulty lost possession, with the ball eventually scrambled behind from a corner.
But it was from that set-piece that the hosts broke the deadlock, as Summerfield’s delivery was headed back by Scot Bennett for Fewster to convert from close range.
Pompey were looking extremely sloppy and were guilty of gifting their opponents the ball on a number of occasions.
York, meanwhile, did not look like a side destined for non-league and doubled their lead on 34 minutes following a quick counter-attack.
Hendrie eventually received the ball wide on the right and sent in a fine low cross that Alessandra slotted home from a few yards out.
There was brief respite at the other end of the pitch when Kyle Bennett shrugged off a couple of challenges and sent a shot flying narrowly over the bar.
But there was still time for the Blues’ evening to get even worse, as Webster went down off the ball and had to be replaced just before the break.
There was no recognised centre-back among the substitutes, so Adam Barton was once again called upon to deputise in defence.
York City 2
York continued to impress after the restart and Ben Davies was called into action to block Galbraith’s drive.
But the hosts did forge further ahead on 48 minutes – not that there was much the Blues could do to prevent it.
It was a stunning strike from Summerfield, who picked up the ball 30 yards out and sent it arrowing into the net.
Pompey came close to reducing the deficit soon after when Michael Smith collected a pass down the left, cut inside and curled a shot narrowly wide.
But they did have a goal in fortunate fashion on 55 minutes, when EVANS was fed by Davies and saw his shot fumbled over the line by Scott Flinders.
The keeper did better to keep out McNulty’s header a few seconds later, although the flag had already been raised for offside.
And the Blues were suddenly look a lot brighter, with Evans flicking Bennett’s corner into the side netting.
But they were still guilty of some sloppy play, with one turnover of possession resulting in Jones saving well to deny James Berrett.
Pompey were soon back on the attack, though, and when Bennett was fouled on the edge of the box, Davies stepped up to curl the free-kick just wide.
Cook made his second switch on 66 minutes, with Tollitt given a chance to impress as Bennett was withdrawn.
The winger was soon involved in the action, reacting quickly after his first effort was blocked and sending a second just over the bar.
But Fewster then missed two chances to wrap the points up as the game became extremely open, sending two shots wide when he should have found the target.
Conor Chaplin was introduced for the closing stages, although it was fellow substitute Tollitt who came close to setting up a grandstand finale on 78 minutes.
He beat his man in the box and drove the ball towards goal, only for a well-placed Hendrie to clear it from the line.
The match was now a breathless affair and it took a fine double save from Jones to stop first Fewster and then Galbraith grabbing a fourth for York late on.
York (4-3-3): Flinders; Hendrie, Bennett, Cameron, Carson; Summerfield, Berrett, Penn (c); Alessandra, Fewster, Galbraith (McEvoy 90+1)
Goals: Fewster 30, Alessandra 34, Summerfield 48
Booked: Summerfield, Carson
Subs not used: Ingham, Swan, Dixon, Riordan, Thompson
Pompey (4-2-3-1): Jones; Davies, Webster (Barton 45+1), Clarke, Stevens; Hollands, Doyle (c); Evans, McNulty (Chaplin 74), Bennett (Tollitt 66); Smith
Goals: Evans 55
Subs not used: Murphy, Freeman, Naismith, McGurk
Referee: Nigel Miller
Attendance: 3,214 (841 Pompey fans)