Barca dominated from start to finish but struggled to create clear chances on an appalling Louis II pitch.
A dull, sweaty match finally came to life in extra-time. Shakhtar finally had a shot on goal, but Julius Aghahowa had his low shot saved by Victor Valdes.
Bojan Krkic almost opened the scoring in the 10st minute, then Messi twice went close with his trademark left-foot drives.
Instead of preparing for the penalty shootout, patient Barca continued to attack - and finally received their just reward thanks to supersub Pedro.