The economically powerful region of Catalonia has voted into office a large majority of pro-independence legislators, but the leader who made a referendum over breaking away from Spain a central plank of his campaign saw his party's majority reduced by 12 seats.
The centre-right Convergence and Union alliance (CiU) of regional president Artur Mas saw its parliamentary majority fall to 50 seats from 62, while leftist pro-independence party ERC came in second with 21, results from the regional government showed, with nearly all votes counted.
Mas appeared on television late on Sunday to thank his party for its support and to acknowledge that they could no longer rule alone as a minority government.
He also said that "those who think the referendum plan has been aborted" needed to do the math.
Two pro-unity parties - Prime Minister Mariano Rajoy's Popular Party and the Catalan Ciutadans - did make modest advances, boosting their seats by seven to 28.
Though a humiliating setback to Mas, who called the election two years early after Madrid rejected his demands for greater fiscal powers for Catalonia, the vote gave forces favouring Catalan statehood a commanding majority overall in the 135-seat Catalan parliament.
Growing Catalan separatism is a huge challenge for the prime minister, who is trying to bring down painfully high borrowing costs by persuading investors of Spain's fiscal and political stability.
Many Catalans are angry that Rajoy has refused to negotiate a new tax deal with their largely self-governing region.
With a bigger population than Denmark and an economy almost as big as Portugal's, Catalonia also has its own language.
Like Basques, Catalans see themselves as distinct from the rest of Spain.
The Catalans accuse Madrid of raising far more in taxes from the region than it returns, and estimates the gap, or fiscal deficit, at 16 billion euros ($21bn) a year -- a figure Madrid disputes.
The region of 7.5 million people accounts for more than one-fifth of Spain's economic output and a quarter of its exports, and boasts one of the world's best football teams, Barcelona FC.
But Catalonia also has a $57bn debt, equal to one-fifth of its output, and was forced to turn to Madrid this year for more than $6.5bn to help make the payments.
However, a eferendum would be illegal under the current Spanish constitution, and Spain's ruling Popular Party is likely to block any attempts for constitutional change.