Voters in the Spanish region of Catalonia have backed pro-independence parties in elections, dealing a major blow to leaders in Madrid, which has been desperate to quell the separatist movement.