Pro-independence parties in Spain's Catalonia region have won an absolute majority in regional elections, near complete results show.
The election has set the region on a collision course with Spain's central government over independence.
The strong pro-independence showing dealt a blow to Spanish prime minister Mariano Rajoy, three months before a national election. His centre-right government, which has opposed attempts to hold a referendum on secession, has called the separatist plan "a nonsense" and vowed to block it in court.
Spain's constitution does not allow any region to break away, so the prospect of a breakaway remains highly hypothetical.
The main secessionist group "Junts pel Si" (Together for Yes) was on track to secure 62 seats, while the smaller leftist CUP party would get another 10, according to official results with 97 percent of the votes counted.
They would jointly obtain 47.8 percent of the vote, on a record turnout of 78 percent, a big boost to an independence campaign which has been losing support over the last two years.
Both had said before the vote that such a result would allow them to unilaterally declare independence within 18 months, under a plan that would see the new Catalan authorities approving their own constitution and building institutions like an army, central bank and judicial system.
The vote in Catalonia, Spain's second most populous region, is widely expected to influence the course of the Spanish general election in December.
Spain's two dominant parties - the ruling People's Party and the opposition Socialists - lost tens of thousands of votes compared with the last vote in 2012, boding ill for their national ambitions, although the PP suffered a much deeper setback than its rival.
Anti-austerity party Podemos also registered a disappointing score at 9 percent, sharply down from last May's nationwide regional and local elections.
Among parties opposed to independence, pro-market Ciudadanos, often cited as a national kingmaker, emerged as the only winner as it jumped to 18 percent of the vote.
Despite the separatist victory, analysts believe the most likely outcome of the election will be to force a dialogue between Catalan and Spanish authorities.
Opinion polls show a majority of Catalans would like to remain within Spain if the region was offered a more favourable tax regime and laws that better protect language and culture.
While investors do not see secession as an immediate material risk, financial markets may react negatively on Monday.