In the early years of the dictatorship, many PCE members joined the Spanish Maquis, a group of guerrillas who fought against the regime.
Juan Carlos I would lead the Spanish transition to democracy, a time when the PCE became also extremely relevant, due to Franco's anti-communist legacy.
Prime Minister Adolfo Suárez legalized the PCE on 9 April 1977, a decision which was particularly controversial, but ended peacefully.
In its statutes, the PCE defines its goals as "democratically participate in a revolutionary transformation of society and its political structures, overcoming the capitalist system and constructing socialism in the Spanish State, as a contribution to the transition to socialism worldwide, with our goals set in the realization of the emancipating ideal of communism".
The former was created in April 1920 from portions of the Socialists' youth organization (Federación de Juventudes Socialistas or FJS) while the latter had been formed from a union of dissident Socialists (terceristas) and members of the General Union of Workers (Unión General de Trabajadores or UGT) who regarded the original PCE as not properly representative of the working class.
In May, Jules Humbert-Droz, the top Comintern official in Western Europe, arrived in Spain to supervise the still fractious party and would continue to do so until the establishment of the republic.
[20] With the advent of the dictatorship of Miguel Primo de Rivera in September 1923, political parties, including the PCE, were repressed and rendered largely powerless though not dissolved.
In 1930, the arguments over doctrine led the Catalan-Balearic Communist Federation (FCCB) to break from the party and associate with the International Right Opposition.
Amid this infighting, Comintern official Dmitry Manuilsky reportedly stated that, while Spain had "an excellent proletariat", it had only "a few little groups, but not a communist party".
The PCE leadership judged that while progressive laws could be passed, an attempt at a full-scale socialist revolution would needlessly divide the forces of the Republic.
Being a well-knit and highly disciplined organization, the PCE could in spite of its numerical weakness play an important part in the war.
After the Republican defeat in April 1939, the PCE was persecuted by the Nationales of caudillo Francisco Franco (1939–1975), although maintained the best organization among the opposition parties inside Spain.
Some PCE members went to the Soviet Union and fought as volunteers for the Red Army during the Second World War, such as General Enrique Líster.
A large section of PCE members were based in France, where a major party organization was set up, although the French government forced them to leave in 1950 during the rising ideological tension of the Cold War.
Dolores Ibárruri, "La Pasionaria", a dedicated follower of consequent Comintern policies, replaced Jose Diaz as General Secretary in 1944, and held the position until 1960.
Communists played a fundamental role in the 1962 miners' strike, the first large-scale social movement since the end of the civil war, by putting their informal networks at its service, but also by involving their exiled activists to organize international solidarity.
In the midst of successive waves of expulsions of members who belonged to the minority currents, the PCE suffered an electoral defeat in 1982, getting just 4% of the vote.
IU shifted back towards a more confrontational attitude towards the PSOE, and José Luis Centella succeeded Frutos as PCE general secretary the next year.
For the 2015 elections, IU joined up with further partners in the Popular Unity (UP) alliance, led by PCE politician Alberto Garzón.
The PCE, meanwhile, moved in its XX Congress in 2017 to explicitly embrace Marxism–Leninism again, marking a break with the previous forty years.