The Portuguese side were dealt an early blow after Luiz Adriano's opener, but a sending off for Rakitskiy gave the hosts a lifeline in their opening Champions League group tie
The Portuguese champions came from a goal behind with goals from Hulk and Kleber after Luiz Adriano's opener.
Five minutes in and the hosts were awarded a penalty when James Rodriguez was brought down in the box following a clumsy challenge from Yaroslav Rakitskiy. Hulk stepped up looking to open the scoring but the Brazilian's effort was denied by the post.
But the spectators didn’t have to wait long for the first goal though. In the 12th minute Shakhtar opened the scoring through Brazilian Adriano.
It was a gift of a goal, Willian’s long range effort was stopped by Helton, but the Porto keeper could not get a grip on the ball, which left the Shakhtar striker the opportunity to nip in and put away the rebound with a simple tap in.
But going behind seemed to kick-start Porto, and the Europa League champions found the equaliser in the 28th minute with a spectacular effort from star man Hulk. The Brazilian ace fired in a thunderbolt of a free-kick from all of 40 yards.
And things swiftly got worse for the Ukranian champions just before half time, after they were reduced to ten men when Rakitskiy was a given a straight red for a dangerous lunge on Joao Moutinho. The away side then altered their formation accordingly with forward Eduardo being withdrawn for defender Oleksandr Kucher.
Just over minutes after the interval, Porto had taken the lead, with Kleber grabbing their second of the night, following a great run and cross from James Rodriguez that left the Brazilian forward with simple tap in.
Porto were soon dominating the game and looking to increase their lead. Oleksandr Rybka had to be alert to stop two drives from James Rodriguez, before the Columbian struck the bar with a curling free-kick with ten minutes to go.
Porto now travel to Russia to face Zenit St Petersburg on the back of an impressive win where as Shakhtar will be looking to regain some pride at home against Apoel Nicosia.