- Danylo Sikan (40')
It was a disappointing display from the Spanish side who won their first three games in the competition and needed one point to book a place in the last 16 with two games remaining.
Barcelona manager Xavi Hernandez made several changes to his starting eleven and, despite dominating possession throughout the match, struggled against a well-organised Shakhtar defence, earning only one shot on target in the game.
Sikan, 22, gave the Ukrainian side a shock lead in the 40th minute against the five-time European champions, who dominated possession throughout the match in Hamburg.
After halftime, Gocholeishvili won the ball off defender Marcos Alonso and unleashed a strike straight into the chest of Ter Stegen.
The goalkeeper made another brilliant reflex save with his right foot to deny a close-range effort by Sikan in the 52nd minute and Newerton later had a goal ruled out for offside.
Barca were unable to threaten opposition goalkeeper Dmytro Riznyk until Xavi made four substitutions at once in the 60th minute, with João Félix and Lamine Yamal coming off the bench to give the visitors a much-needed spark.
However, Shakhtar held firm against some late pressure to seal the three points.
"The Champions League demands the highest level and today we didn't give it, we leave angry. Intensity? No, today I would put it down to the game, we didn't play well. We have to recover and improve," Xavi told Movistar Plus.
Barcelona remain top of Group H with nine points from four games, three ahead of Porto and Shakhtar.
The Portuguese side have a game in hand and face Antwerp, who have no points, later on Tuesday.
- Irfan Peljto