Hulk put the Portuguese champions ahead with a composed finish on 79 minutes, before a late own goal from Razvan Rat set up a Group G decider with Zenit St Petersburg on matchday six.
With APOEL already ensured of a place in the knock-out stages, Porto will entertain Zenit needing a win to join them in the last 16. Zenit will go through with a draw. Shakhtar, meanwhile, were knocked out of Europe altogether with tonight's result.
Below freezing temperatures met the teams in Ukraine, but the attacking ambition of both teams soon warmed up a vocal crowd.
Luiz Adriano had the game's first chance inside a minute. The Brazilian was allowed space to shoot on the edge of the box, but his weak effort was straight at his countryman Helton in the Porto goal.
Porto's Hulk had the next opportunity, bringing the ball down superbly in the box before side-footing towards goal - only for Shakhtar defender Yaroslav Rakitskiy to slide in and make a last-ditch clearance.
Hulk was a constant threat during an open first half, with the highly sought-after striker operating on a shoot-on-sight basis throughout. Most of his efforts were wild ones, however, and those that did find their target were straight at Olexandr Rybka.
The best chance of the half fell to Shakhtar on 19 minutes. Adrianoheld off the strong challenge of Nicolas Otamendi and shot against the post from the edge of the box. Had he gone down, he may well have won a penalty and Porto been reduced to 10 men.
The second half continued where the first left off, with both sides looking to get forward and plenty of space to exploit all over the pitch.
Adriano had another good chance early on, but he shot straight at Helton when he really should have tested him further.
Shaktar's Eduardo threatened soon after, but his trickery inside the Porto box failed to culminate in a final ball worthy of the build-up.
On 73 minutes Shakhtar hit the post for a second time, when Fernandinho's effort was tipped onto the upright by Helton at full stretch. The Porto goalkeeper did well to react quickly and claim the rebound.
Then came the game's defining moment. Joao Moutinho spotted the run of Hulk, and the striker took the ball in his stride before finishing with aplomb. The goal was a hammer blow for Shakhtar and they never looked like recovering.
The final act came in injury time, when Rat put through his own net under pressure, but by that time the home fans and their players had already conceded the end of their European season.
Attention now focuses to the December 6 clash between Porto and Zenit, which will see both sides fighting it out for a highly lucrative berth in the knock-out stages.