The regional government of Catalonia pressed ahead with the mock vote on November 9 even though the court had ordered that it be suspended while it considered a request from Spain's central government that it be declared unconstitutional.
Some 2.3 million people out of a total of 6.3 million eligible voters took part in the ballot. Of those who did participate 1.9 million - over 80 percent - voted in favour of independence.
The ballot was set up and manned by grassroots pro-independence organisations and held in public places such as schools.
Catalonia's conservative leader Artur Mas had argued that the referendum was legal because the result was non-binding.
But the court ruled that the referendum was unconstitutional because a regional government cannot hold a referendum on issues that concern the entire country.
Public prosecutors in November filed a lawsuit against Mas and two other Catalan government officials, accusing them of serious disobedience and abuse of public funds for going ahead with the vote.
If successful, the legal action against Mas could block him from taking part in future elections.
Mas staged the mock referendum after the central government blocked a full-blown referendum in the courts.
He is planning to call a regional election in Catalonia on September 27 meant as a proxy vote on independence from Spain.
The ruling sparked outrage across Catalonia where it was viewed by many as another example of bullying from Madrid.
Mas insisted that Catalan voices would not be silenced. "9N cannot be erased. More than 2.3 million people voted and 40,000 volunteers helped out," he said in a statement responding to the ruling.
Tweet with the words of President Mas, sent by his press secretary.