Catalan separatist parties are on track to win most seats in the new regional parliament, setting the stage for more confrontation with Spain’s government.
However the Citizens party, which wants Catalonia to remain a semi-autonomous part of Spain, is the biggest party.
As a result, it is unclear who will be given the right to form a government.
The Madrid government stripped Catalonia of its autonomy and called the election after declaring an October independence referendum illegal.
With more than 95% of votes counted, Citizens (Cs) had 25%, winning 36 seats in the 135-seat chamber.
But the pro-independence parties Together for Catalonia, Republican Left of Catalonia and Popular Unity were together on course to win a total of 70 seats, giving them a majority.
Within the separatist party block, ousted Catalan President Carles Puigdemont’s Together for Catalonia party was slightly ahead of the Republican left of Catalonia, led by his former deputy Oriol Junqueras.
Mr Puigdemont is in self-imposed exile in Brussels. He is accused by Spanish prosecutors of rebellion and sedition.
Turnout was more than 80%, a record for a Catalan regional election.
Why did the election take place?
Separatists who dominated the previous Catalan parliament declared independence on 27 October, after the referendum.
In an attempt to stop that referendum, Spanish police stormed some polling stations. However voters defied the Spanish courts and riot police to cast their ballots.
The move led to violent clashes with hundreds of people reported injured. Footage showing police tackling people at polling stations and pulling a woman by her hair caused outrage.
According to the organisers, 90% of voters were in favour of independence, but fewer than half the region’s electorate took part.
Mr Puigdemont decided it was enough to declare independence from Spain.
Spanish Prime Minister Mariano Rajoy then sacked the Catalan government, imposed direct rule and called the 21 December election.