Pedro, who came on for Zlatan Ibrahimovic after 81 minutes on a hot and humid night at the Stade Louis II, fired past Shakhtar goalkeeper Andriy Pyatov from just inside the box in the 115th minute and with the game seemingly set for a penalty shootout.
The scorer capitalised on good work by Lionel Messi as Barca added the UEFA Super Cup to their Champions League trophy, last season's domestic cup and league double and the Spanish Super Cup they won earlier this month.
Pedro, 22, who developed through the youth ranks and has just been handed a new contract by the club, told Spanish TV: "I really wasn't expecting it.
"It was an important goal but it must be said it was down to the work of the whole team. It certainly wasn't an easy match. Messi's pass put me clear and I managed to finish it off."
It was Barca's third win in the UEFA Super Cup and the fifth time the European champions had beaten the UEFA Cup holders in 12 meetings since the event was moved to Monaco in 1998.
However it was a match that will not live long in the memory as neither side produced a serious goal attempt in an uninspired 90 minutes, although it did improve as a spectacle in the second half after a woeful first period.
At least both sides went looking for a winner in extra-time.
There were some good individual touches, especially from Shakhtar's Brazilian midfielder Willian who gave the Barca defence a couple of worrying moments when he ran at them with pace and purpose.
His good intentions came to nothing though, with Victor Valdes in Barca's goal and opposite number Pyatov virtual bystanders.
Valdes did not have a shot to save until the eighth minute of extra-time as the European champions camped in Shakhtar's half for most of the match.
Barca's best chance in the opening period fell to Thierry Henry, one of three players from his team returning to their old AS Monaco home ground, but his well struck 20-metre shot flew just over the bar in the ninth minute.
Messi, so often Barca's inspiration, worked hard with little reward until the goal came, although he did force Pyatov to make an instinctive save from a powerful drive after 73 minutes.
The Argentine produced the best moment of skill in regulation time when he ran through the defence before being blocked. He then received a yellow card along with Shakhtar defender Olexandr Kucher when the two squared up to each other.
Sweden striker Ibrahimovic was well marshalled by Dmytro Chygrynskiy, the tall Shakhtar centre-back who is due to sign for Barca next week.
The defender received a big ovation from both sets of fans when his name was announced before the kick-off.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1