Barcelona missed two penalties in normal time.
Miralem Pjanic and Ousmane Dembele both were denied the penalties from the spot by Cornella goalkeeper Ramon Juan in normal time.
But Dembele finally opened the scoring in the 92nd minute and Martin Braithwaite smashed the second goal in the dying minutes of added time.
Barcelona missed the spot-kick five out of 12 times this season alone.
View this post on Instagram
The Blaugrana somehow managed to qualify for the last 16 of the Copa del Rey.
Ronald Koeman was frustrated with the team’s inability to kill the game off long before.
“The key thing is always to progress to the next round, but we can’t be happy because we’ve missed chances and penalties and you need to have responsibility in these games,” said Koeman after the win.
“Again it’s 120 [minutes], which is an issue as that’s three straight matches now and it’s on us. We’ve made chances and had two penalties… that can’t happen.
“I can’t fault our effort, but it’s not just about running, also creating and being effective. It was tough for us today… it’s not acceptable.”