Barcelona scrape past Intercity in Spanish Cup thriller to reach last 16