A pro-independence alliance has won a majority of seats in the Spanish region of Catalonia, plunging Spain into a constitutional crisis just two months ahead of national elections.