Barcelona needed an injury-time winner from Clement Lenglet to edge past third division side Cultural Leonesa in the first leg of their Copa del Rey tie.
The last-32 game looked set to be a goalless draw, but French defender Lenglet headed home his first Barca goal from Ousmane Dembele's free-kick.
Barca, winners of the cup for the last four seasons, saw midfielder Sergi Samper limp off in the first half.
The second leg takes place at the Nou Camp on 5 December.
- 1PalatsíBooked at 82mins
- 2GonzálezBooked at 26minsSubstituted forAlonsoat 78'minutes
- 4GonzálezBooked at 90mins
- 6RomeroSubstituted forCalvoat 60'minutesBooked at 78mins
- 3EscalanteBooked at 53mins
- 10OrtízBooked at 83mins
- 7MarcosBooked at 90mins
- 5Bernal Villarig
- 8Beltrán Martínez
- 11García PérezSubstituted forRodríguezat 68'minutes
- 9Santana Cabrera
- 15Delgado Serna
- 18Mancebo Serrano
- 2Nélson Semedo
- 33CuencaSubstituted forLengletat 61'minutes
- 27MirandaBooked at 41mins
- 16SamperSubstituted forAleñáat 33'minutes
- 6D Suárez
- 14MalcomSubstituted forArthurat 80'minutes
- 19El Haddadi
- Mario Melero López
- Shots on Target