Napoli's Polish midfielder Piotr Zielinski missed a chance to double their lead when he shot over the bar after a defensive mix-up left him in a promising position.
But minutes later Zielinksi made amends, confidently slotting into the far bottom corner after a smart exchange with Dries Mertens.
Seven minutes from the end, Mertens made sure of the win when Shakhtar keeper Andriy Pyatov palmed out a Raul Albiol header straight to the Belgian forward who nodded home.
It left Napoli third on six points, three behind Shakhtar Donetsk, before the final round of games which sees Napoli away at Feyenoord and the Ukrainians at home to group winners Manchester City.
(Reporting by Simon Evans; Editing by Ian Chadband)
