After the Spanish general election of 28 April 2019 failed to deliver an overall majority for any political party, extensive negotiations ensued to form a government in the country. As a result, the previous cabinet headed by Pedro Sánchez was forced to remain in a caretaker capacity for 254 days until the next government could be sworn in.

Despite the April 2019 election delivering a clear plurality for the left-of-centre bloc, with the Spanish Socialist Workers' Party (PSOE) and Unidas Podemos being able to command a majority together with regionalist and nationalist political forces, negotiations were frustrated as a result of conflicting positions between the two parties on the future government's composition. Both parties' opposite stances saw Pedro Sánchez trying and failing to pass an investiture vote on 23–25 July. Subsequently, a political impasse set in as King Felipe VI could not find a new candidate to nominate with sufficient parliamentary support. As a result, a snap election was held on 10 November.

The second election delivered a diminished plurality for PSOE and Unidas Podemos, which ended up accepting their shared responsibility and agreed on a joint government two days after the vote. A new investiture attempt on 5–7 January 2020 saw Sánchez re-elected as prime minister, leading to the formation of the first nationwide coalition cabinet in Spain since the Second Spanish Republic.

Legal provisions The Spanish Constitution of 1978 outlined the procedure for government formation, which started with the monarch summoning representatives of the various political groups in the Congress of Deputies to a round of talks or consultations, after which a candidate was to be nominated through the President of the Congress to attempt investiture as prime minister.

For a nominated candidate to be granted confidence, he or she required to secure the support of an absolute majority in the Congress, or of a plurality in a subsequent vote held 48 hours later. If any of such ballots was successful, the monarch would appoint the elected candidate as prime minister. Otherwise, a two-month period would begin in which new investiture proposals could be attempted under the aforementioned procedure, with parliament being automatically dissolved and a snap election held if no candidate was successful in securing the confidence of parliament.

The procedure for investiture processes was regulated within Articles 170 to 172 of the Standing Orders of the Congress of Deputies, which provided for the investiture debate starting with the nominated candidate explaining their political programme without any time limitations. Subsequently, spokespeople from the different parliamentary groups in Congress were allowed to speak for thirty minutes, with an opportunity to reply or rectify themselves for ten minutes. The nominated candidate was allowed to take the floor and speak at any time of his or her request during the debate.

First formation round (April–September 2019) Post-April 2019 election developments Election aftermath

While the April 2019 Spanish general election produced a hung parliament, the resulting parliamentary arithmetics coupled with the scale of the People's Party (PP) collapse ensured that the Spanish Socialist Workers' Party (PSOE) of incumbent Prime Minister Pedro Sánchez was the only party that could realistically form a government. The outgoing government had been a PSOE minority cabinet with the external support of Unidas Podemos—the electoral alliance of Pablo Iglesias's Podemos, United Left (IU), En Comú Podem, Equo and other minor left-wing parties—as well as case-by-case support from the smaller regional and nationalist parties; after the election such a scheme could count with the 165 seats garnered by both PSOE and Unidas Podemos, but was hampered by the former's reluctance to reach any deal with Republican Left of Catalonia (ERC), which, together with Together for Catalonia (JxCat), had triggered the April 2019 election by siding with right-of-centre parties to reject Sánchez's 2019 General State Budget. Another possibility was an alliance between the PSOE and the liberal Citizens (Cs) party of Albert Rivera, together commanding an overall majority of 180 seats in the Congress of Deputies, but animosity among grassroot PSOE supporters to such deal (well represented by chants of "Not with Rivera!" during the party's victory celebrations), as well as Rivera's own pre-election veto to any sort of agreement with Sánchez, meant that such a scenario was unlikely.

Both Cs and PP leader Pablo Casado—who described his party's dismal performance as "very bad" but rejected to resign from his post—vyed for the leadership of the opposition to Sánchez's government, with far-right Vox having entered parliament for the first time. As a result of the election, the Spanish right was fragmented into three slices which, even taking regional allies such as Navarrese People's Union (UPN)—running within the Navarra Suma alliance—into account, could only muster 149 seats, far from any prospective shot at forming a government. Rivera quickly rejected any chance of agreement with the PSOE, pointing out that "Sánchez and Iglesias are going to govern with the nationalists", despite attempts from both PSOE and PP to court the party into abstaining in order to allow the investiture process to proceed.

On 1 May, Sánchez arranged meetings with Casado, Rivera and Iglesias within the following days at Moncloa Palace in order to evaluate the post-election situation and probe their parties' stances towards his investiture, with the PSOE's aim being to renew their minority government and sustain it through stable parliamentary agreements with other parties, which would include Unidas Podemos and regionalists. Iglesias, who claimed of having learned of such arrangements throughout the media, demanded as a prerequisite for supporting Sánchez's investiture that a coalition be formed between their two parties, calling for not taking for granted Unidas Podemos's support if such a condition was not met. Nonetheless, following the meetings on 6 and 7 May and with both Casado and Rivera confirming their negative stance to Sánchez's election, Iglesias came out positively that both him and Sánchez had "agreed to work in reaching an agreement". It was commented that Sánchez expected for a new government to be up and running by 20 June, but acknowledged that negotiations and the investiture vote itself would be delayed as a result of the ongoing campaign for the 26 May local, regional and European Parliament elections.

Initial approaches The sympathetic attitude between PSOE and Unidas Podemos was first put to test in the negotiations for the Congress of Deputies bureau on 21 May, which saw Territorial Policy minister Meritxell Batet becoming new president of the chamber as well as both parties securing a majority of the nine posts at stake (namely, those of the four vice presidencies and the four secretaries), with the PSOE securing three and Unidas Podemos the remaining two.

Election of the President of the Congress of Deputies Ballot → 21 May 2019 21 May 2019 Required majority → 176 out of 350 Simple Meritxell Batet (PSC) Ana Pastor (PP) Sara Giménez (Cs) colspan="2" Ignacio Gil Lázaro (Vox) colspan="2" Blank ballots Invalid ballots Absentees Sources Aside of PSOE and Unidas Podemos, various regionalist parties also supported Batet and other PSOE members to the Congress bureau: the Basque Nationalist Party (PNV), Canarian Coalition (CCa), Commitment Coalition (Compromís) and the Regionalist Party of Cantabria (PRC), for a total of 175 supportive votes—one short of an overall majority—whereas ERC and EH Bildu cast invalid ballots including the word Llibertat (Catalan for "freedom") in protest for the jailing of several pro-Catalan independence leaders within the context of the judicial process investigating the events surrounding the failed 2017 referendum.

The 26 May elections saw the PSOE securing substantial wins and a number of territorial gains, whereas support for Unidas Podemos-supported candidacies plummeted. This prompted the PSOE to feel strengthened in the government formation negotiations and to ask Iglesias to reconsider his demands for a coalition, with Sánchez proposing a single-party cabinet that incorporated "renowned independents who may be well regarded by progressives", which could see the appointment of Unidas Podemos-proposed members beyond the coalition formula. While the incorporation of Podemos into the government had been generally seen as feasible after the 7 May Sánchez–Iglesias meeting, Iglesias acknowledged that his negotiating position had been weakened by his party's results in the local, regional and European Parliament elections, but insisted on his demand for entering the cabinet nonetheless. Concurrently, the PSOE attempted to pressure Cs into abstaining to ease Sánchez's election in an investiture vote, but this was met with a new rejection from Rivera's party.

Candidate Pedro Sánchez (PSOE): first attempt June developments

Following the 26 May elections, King Felipe VI held a round of consultations with the various parties with parliamentary representation in the Congress of Deputies which saw Pedro Sánchez being formally nominated as prime ministerial candidate on 6 June, which he accepted. Sánchez stressed that there was no alternative to his government and asked PP, Cs and Unidas Podemos for "high-mindedness" and "responsibility" to let him govern. By this point, conversations with other political parties had not seen any advance: CCa had already rejected supporting Sánchez if it meant either a coalition or a programmatic agreement with Podemos, UPN was willing to allow Sánchez's investiture only if he pressured his party's regional branch in Navarre to allow a UPN-led regional cabinet following the 2019 Navarrese election, whereas the position of pro-independence parties—namely, ERC, JxCat and EH Bildu—was dependant on Sánchez's stance towards their jailed leaders. An agreement was quickly reached with the Regionalist Party of Cantabria (PRC), which pledged its support to Sánchez's investiture in exchange for the PSOE renewing its support for Miguel Ángel Revilla as Cantabrian president following the 2019 regional election.