Porto snatched victory at Shakhtar Donetsk to set up a shoot-out with Zenit St Petersburg for a place in the last 16 of the UEFA Champions League.
The hosts twice hit the woodwork before being undone by Hulk's strike 11 minutes from time. Razvan Rat's stoppage-time own goal added insult to injury. It meant any hopes of Shakhtar reaching even the UEFA Europa League disappeared, while Porto will need to beat Zenit at home to claim the second qualification spot to the knockout stages from Group G alongside APOEL Nicosia.
In the opening moments, Luiz Adriano should have done better when he fired straight at Porto goalkeeper Helton from the edge of the box. Shakhtar stopper Olexandr Rybka did well to keep out Hulk's shot on the line as the match got underway at a frantic pace.
In the 10th minute, Vasili Kobin crossed well for Willian, but his shot was easy for Helton. Shakhtar came agonisingly close in the 19th minute, when Eduardo played in Adriano, who beat Rolando before smashing the ball against the post.
The efforts were slightly less convincing from Porto, as Joao Moutinho's speculative effort was comfortably dealt with by Rybka and Hulk shot wide after cutting in from the right. Hulk produced another disappointing strike just after the half-hour while, at the other end, Olexander Kucher's opportunistic overhead kick went wide.
Despite being played at a good pace with some neat touches here and there, there were few chances as the half progressed. And, aside from a Luiz Adriano strike two minutes after the restart which was comfortably held by Helton, that pattern continued in the early stages of the second period.
Indeed, it was not until the 69th minute when Porto finally threatened, when Hulk's blast was saved at the near post by Rybka and Alvaro Pereira fired wide moments later.
It was Shakhtar though who again went within inches of scoring when, in the 73rd minute, Fernandinho's bobbling shot was turned onto the post by Helton. It was the second time they had hit the woodwork and Porto made them pay.
Moutinho was the architect, playing a fine through-ball for Hulk - who knocked the ball past Rybka and into the net to leave the hosts stunned. A miserable night was completed for the hosts when Rat put the ball into his own net when trying to clear in stoppage time.