Socialist rule of the region began with the Spanish Revolution of 1936, resulting in workers' control of businesses and factories, collective farming in the countryside, and attacks against Spanish nationalists and the Catholic clergy. The growing influence of the Communist Party of Spain's (PCE) Popular Front government and their desire to nationalize revolutionary committees and militias brought it into conflict with the CNT and POUM, resulting in the May Days and the eventual replacement of the CNT by the PCE as the major political force in Catalonia until the arrival of the fascists.
In the early 20th century, socialism and anarchism grew throughout Spain. There was widespread discontent in Catalonia, which was heavily industrialized and was a stronghold of the anarcho-syndicalist trade unions. A series of strikes due to wage cuts and in response to military conscription for the Rif War in Morocco culminated in the Setmana Tràgica (Tragic Week), July 25 – August 2, 1909, in which workers rose up in revolt and were suppressed by the army. The anarcho-syndicalist Confederación Nacional del Trabajo (CNT) was formed in October 1910 and immediately called for a general strike, which was suppressed by the military. Further strikes followed in 1917 and 1919 amidst growing violence between the police and trade unions. With the CNT outlawed, the Federación Anarquista Ibérica (FAI) was formed in 1927 as a clandestine alliance of affinity groups during the dictatorship of Miguel Primo de Rivera. Its radical members, who were also part of the CNT, exerted considerable influence on the other members of the trade union. During the Second Spanish Republic, anarchists continued to lead uprisings such as the Casas Viejas revolt in 1933 and the Asturian miners' strike of 1934 which was brutally put down by Francisco Franco with the aid of Moorish troops.
During the Spanish coup of July 1936, anarchist and socialist militias, along with Republican forces including the Assault and Civil Guards, defeated the forces controlled by Nationalist army officers in Catalonia and parts of eastern Aragon. The Confederación Nacional del Trabajo-Federación Anarquista Ibérica now came to the forefront as the most powerful organization in Barcelona, seizing many arms and strategic buildings such as the telephone exchange and post offices. Through the various factory and transport committees, they dominated the economy of Catalonia. In spite of their militant anti-statism, they decided not to overthrow the Catalan government. The president of the Generalitat of Catalonia and head of the Republican Left of Catalonia (ERC), Lluís Companys, was generally accommodating with the CNT but was wary of their appropriation of the means of production. The CNT and Companys worked together to set up the Central Anti-Fascist Militia Committee, which became the main governing body in the region.
In spite of the fact that anarchist philosophy was against centralized government of any form and that the CNT-FAI had always shunned parliamentary politics while attacking the Socialists for collaborating with the state, by September 1936 they had decided to join the Generalitat of Catalonia. The CNT feared that arms would be withheld and that they would be isolated if the Generalitat under Lluís Companys formed a government with the Unified Socialist Party of Catalonia (PSUC). CNT members filled the Ministries of Health, Supplies and Economy and the Central Anti-Fascist Militia Committee was dissolved.
Soon after, the CNT also joined the national government. On October 18 a CNT plenary session of the regional federations granted the national committee secretary Horacio Martínez Prieto full powers to conduct negotiations with prime minister Francisco Largo Caballero. CNT representatives Juan García Oliver, Joan Peiró, Federica Montseny and Juan López filled seats in Caballero's cabinet. They took control of the national ministry of justice, industry, health and commerce, respectively. The CNT saw this "maximum concession compatible with its antiauthoritarian spirit" as crucial to winning the war. There was widespread friction and debate between the "collaborationist" and "abstentionist" anarchists in the CNT. Many anarchists outside of Spain (such as Alexander Schapiro) criticized CNT-FAI for entering into the government. There was also concern among anarchists with the growing power of Marxist communists within the government. Anarchist Minister of Health Federica Montseny later explained: "At that time we only saw the reality of the situation created for us: the communists in the government and ourselves outside, the manifold possibilities, and all our achievements endangered."
Some anarchists outside of Spain viewed their concessions as necessary considering the possibility of the Nationalists winning the war. Emma Goldman said, "With Franco at the gate of Madrid, I could hardly blame the CNT-FAI for choosing a lesser evil: participation in government rather than dictatorship, the most deadly evil."
Throughout Catalonia many sectors of the economy fell under the control of the anarchist CNT and the socialist UGT trade unions, where workers' self-management was implemented. These included railways, streetcars, buses, taxicabs, shipping, electric light and power companies, gasworks and waterworks, engineering and automobile assembly plants, mines, mills, factories, food-processing plants, theaters, newspapers, bars, hotels, restaurants, department stores, and thousands of dwellings previously owned by the upper classes. While the CNT was the leading organization in Catalonia, it often shared power with the UGT. For example, control of the Spanish National telephone company, was put under a joint CNT-UGT committee.