The Red Sox had built a 7-3 lead earlier in the marathon contest, thanks in part to Napoli's three-run shot in the third inning, but New York scored the next four runs to forge a 7-7 deadlock in the seventh.
That's how the game stood until two were out in the bottom of the 11th, when Napoli blasted a pitch from Adam Warren (1-1) into the seats in straightaway center field.
Jonny Gomes also went deep and Shane Victorino drove in two runs for American League East-leading Boston, which took two-of-three from the Yankees and maintained a 1 1/2-game divisional lead over Tampa Bay.
Pedro Beato (1-0), the seventh Bosox pitcher, earned the decision after tossing a scoreless top of the 11th.
Notable deaths of 2014 [PHOTOS]
Julius Randle breaks leg during NBA debut