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.
The Madrid government stripped Catalonia of its autonomy and called the election after declaring an October independence referendum illegal.
With more than 95 percent of votes counted, Citizens (Cs) had 25 percent, 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 who is currently in prison charged with rebellion and sedition.
Speaking in Brussels, where he is in self-imposed exile, Mr Puigdemont said the "Catalan republic" had won and "the Spanish state has been defeated".
He is accused by Spanish prosecutors of rebellion and sedition.
Turnout was more than 80 percent, a record for a Catalan regional election.
Why did the election take place?
Seperatists had promised in the previous election they would hold a popular vote on Catalan independence from Spain.
In their referendum on 27 October, which the Spanish government rejected, organisers reported 90 percent of voters were in favour of independence.
Mr Puigdemont said after the vote that the region had won the right to statehood, despite a Spanish police crackdown on voters that left more than 750 people injured.
Footage that showed police tackling people at polling stations and pulling a woman by her hair caused outrage.
Mr Puigdemont signed a declaration of independence, but suspended it to allow dialogue with the Madrid government.
Spanish Prime Minister Mariano Rajoy then sacked the Catalan government, imposed direct rule and called the 21 December election.
Eight Catalan politicians were arrested, while Mr Puigdemont and four of his advisers fled to Belgium.
They later turned themselves in to Belgian authorities after an arrest warrant was issued, but were freed after being questioned.
- BBC