BARCELONA—Catalan separatists on Friday vowed to press on with an independence referendum despite government efforts to block the ballot, setting the ground for a potentially chaotic vote on Sunday and bringing to a head a confrontation that has been looming for years.

Dreams of independence many Catalans have sustained for decades will be tested in the referendum that reflects the deep fault lines in Spanish identity and the centrifugal forces still at play in Europe.

If the fissures widen further and tip into mass civil disobedience, they could overwhelm Prime Minister Mariano Rajoy’s fragile government and sap confidence in Spain as one of Europe’s brightest postcrisis economic stars.

The Spanish government deems Catalonia’s vote illegal because it violates the constitution’s promise of “indissoluble unity.” It has arrested pro-independence leaders, frozen the regional government’s spending authority and sent thousands of police officers to the northeastern region to ensure schools and other public places aren’t used as polling stations.

Catalan officials said voters would still be able to cast their ballots on Sunday at 2,315 polling stations by placing paper ballots into plastic ballot boxes. “Have no doubt there are alternatives,” Catalan Vice President Oriol Junqueras told reporters with a sly smile, without providing details on how voters would get around potential police blockades. “There are many ways to vote.”