
Jake Charles' excellent first half finish sent Town ahead at the Towbar Express Stadium before the Seasiders were reduced to level terms towards the 50 minute mark following Ollie Pearce's close-range finish.
Nathan Haslam's side, who were also celebrating Shane Bland's ten years with the club in a fixture which doubled up as his Testimonial, were delivered another blow in the 70th minute as York substitute Marvin Armstrong netted a winner for the visitors.
The hosts began the pre-season encounter in bright fashion with Nathan Thomas' cross from the right flank almost picking out Charles at the back post, but the forward couldn't quite a touch at full stretch.
Whitby continued their push for an early breakthrough, with Thomas' effort inside the area falling kindly into the hands of Harrison Male before Stephen Walker's close-range effort was also directed on target, but once again into the grateful grasp of the visiting shot-stopper.
In the 34th minute, Whitby took the lead courtesy of Charles' powerful strike on the back of a quick move. After Bland picked out Thomas close to the half way line, the former York City winger drove forward before teeing up the striker to unleashed a powerful strike beyond the reach of Male.
It was the Minstermen who began the second half in positive fashion and their reward was a leveller. After Dipo Akinyemi's run saw him bring the ball into the box, he diverted it into the path of Pearce, who stroked the ball beyond Seasiders goalkeeper Bland.
Akinyemi, one of several half-time substitutions, saw two big chances got astray thanks to some fantastic goalkeeping from Bland as the visitors upped the tempo.
The attacking surge continued as Tyreece Sinclair, a real thorn in the Whitby side, charged at the host's defence, who, in fairness, dealt with everything fired at them confidently and efficiently.
In the 70th minute, Whitby fell behind following Armstrong's clinical finish as the pressure eventually told. The ball found its way to the attacker who slotted the ball into the bottom corner beyond the reach of Bland.
Arguably the best moment of the night came in the closing stages as Town manager Haslam took the opportunity to give his number one the recognition he deserved. He was substituted off to be replaced by Nick Cranston as the entire Towbar Express Stadium crowd rose to their feet to applaud the shot-stopper.