By
Voters who arrived just before the polls closed were still allowed to cast their ballot.
Turnout was exceptionally high, official data showed.
The election was held just two months after a failed secession bid in Catalonia, which triggered the country's worst crisis in decades.
The vote pitted leaders of the region's separatist movement against parties that want to remain in Spain.