2015–2016 Spanish government formation

Attempts to form a government in Spain followed the inconclusive Spanish general election of 20 December 2015, which failed to deliver an overall majority for any political party. As a result, the previous People's Party (PP) cabinet headed by Mariano Rajoy was forced to remain in a caretaker capacity until the election of a new government.

After a series of inconclusive inter-party negotiations, leader of the Spanish Socialist Workers' Party (PSOE) Pedro Sánchez tried and failed to pass an investiture vote on 2–4 March. 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 26 June. The second election also proved inconclusive, and a failed investiture attempt by Rajoy on 31 August raised the prospect of a third election.

On 1 October, a party rebellion resulted in Sánchez being ousted as leader of the PSOE and the latter voting to allow the formation of a PP minority government. This materialized on 29 October when the PSOE abstained in Rajoy's second investiture bid, thus ending the political deadlock after days without an operational government.

Legal provisions
The procedure for government formation in Spain was outlined in Article 99 of the 1978 Constitution: 1. After renewal of the Congress of Deputies, and in other cases provided under the Constitution, the King, after consultation with the representatives appointed by the political groups with Parliamentary representation, and through the Speaker of Congress, shall nominate a candidate for President of the Government. 2. The candidate nominate [sic] in accordance with the provisions of the foregoing paragraph shall submit to the Congress of Deputies the political programme of the Government that he intends to form and shall seek the confidence of the Houses. 3. If the Congress of Deputies, by vote of the absolute majority of its members, invests said candidate with its confidence, the King shall appoint him President. If an absolute majority is not obtained, the same proposal shall be submitted for a new vote forty-eight hours after the previous vote, and it shall be considered that confidence has been secured if it passes by a simple majority. 4. If, after this vote, confidence for the investiture has not been obtained, successive proposals shall be voted upon in the manner provided in the foregoing paragraphs. 5. If within two months after the first vote for investiture no candidate has obtained the confidence of Congress, the King shall dissolve Congress and call new elections, following endorsement by the Speaker of Congress.

Initial positions
As the 2015 Spanish general election produced a very fragmented parliament, a multi-party agreement was expected to be required in order for a stable government to be formed. Caretaker prime minister and People's Party (PP) leader Mariano Rajoy said that he would try to form an administration, whereas opposition and Spanish Socialist Workers' Party (PSOE) leader Pedro Sánchez advocated for a change in government. Two possible coalitions based on the left–right political spectrum, the right-wing (PP with Citizens (C's))—and the left-wing (PSOE with Podemos), were both short of an overall majority—set at 176 seats—by themselves.

There was speculation around four outcomes:


 * A grand coalition of PP and PSOE, an unprecedented phenomenon in Spanish politics but the only feasible two-party deal that would be able to reach an absolute majority, with 213 seats.
 * A PSOE, Podemos and C's alliance, comprising 199 seats.
 * A PSOE, Podemos and United Left (IU) coalition—comprising 161 seats—together with smaller regional parties.
 * Parliamentary deadlock lasting for two months from a first failed investiture ballot, resulting in a new general election to be held at some point throughout 2016.

As a result of the arithmetical infeasibility of an alliance with C's, Rajoy intended for reaching out to the PSOE to at least secure their abstention in his investiture, even suggesting giving them out some additional posts in the Congress bureau. This possibility was not contemplated by Sánchez, but he and his party avoided making any comments on the formation of an alternative left-wing government that included Podemos and its regional alliances. Some within the party—such as president of Castilla–La Mancha Emiliano García-Page—pointed out that, even if the PSOE obtained Podemos's support, it would not muster a majority without that of other parties as well and advocated for the party to remain in opposition.

Podemos leader Pablo Iglesias laid out stiff terms in order to consider starting negotiations with any party, including the protection of rights within the Constitution, electoral reform, the introduction of recall elections and a new territorial agreement that recognized Spain as a plurinational state and allowed for the recognition of a self-determination referendum in Catalonia. The party's policy secretary, Íñigo Errejón, also expressed their initial refusal to support Sánchez as a prospective candidate for prime minister, suggesting instead to look for "an independent candidate, above parties". C's leader Albert Rivera had promised during the campaign that he would not be actively supporting either a PP or a PSOE-led government, but that his party could consider an abstention to allow the formation of a minority PP cabinet and that it would oppose any alliance in which Podemos was involved.

PSOE's stance
As a consequence of the election, the PSOE was placed in a kingmaker position. Several regional PSOE leaders rallied around Andalusian president Susana Díaz and warned Sánchez against any agreement with Podemos, seeing the conditions put forward by Pablo Iglesias in the election aftermath as "unaffordable". Some regional premiers from the party—such as García-Page, Valencian president Ximo Puig, Asturias's Javier Fernández or Extremadura's Guillermo Fernández Vara—favoured letting the PP try to form a government on its own. After a meeting with Rajoy on 23 December, Sánchez opposed any deals with the PP and voiced his preference to probe alternative alliances instead, while also rejecting a previous proposal from Albert Rivera of a deal between PP, PSOE and C's—explicitly excluding Podemos—that promoted "the regeneration policy reforms that Spain needed".

Sánchez also faced criticism from within his own party in light of his election result—the worst in the PSOE's recent history up to that point—as his critics aimed for a party congress to be held in February to vote on a new leadership. Díaz—who had become the leading figure of the PSOE's internal opposition to Sánchez—sought to become the new party leader and to eventually lead the PSOE into a new general election,  wanting to limit Sánchez's pact policy through the resolutions of the party's federal committee. This was accomplished on 28 December, when the party determined that, should Podemos not withdraw its red line condition to hold a referendum in Catalonia, the party would not discuss any pacts with them, requiring Sánchez to avoid becoming prime minister "at any price". Concurrently and in spite of his strong contestation within the party, Sánchez suggested delaying the PSOE leadership election until a new government was formed or a new election was held, with critics claiming that the election should be held "when it is due".

In order to force Sánchez into the negotiating table, PP, Podemos, and C's took advantage of the growing rebellion within the PSOE. Pablo Iglesias questioned that people within the PSOE "wouldn't allow Pedro be prime minister", noting that Sánchez "does not control" the party, while warning of the dangers of a hypothetical "three-way grand coalition" between PP, PSOE and C's that Podemos would oppose. Rivera pointed out that his party was waiting "for [the PSOE] to solve its internal affairs", whereas the PP reaffirmed its claim to lead the next Spanish government by seeking a multy-party pact with PSOE and C's. PSOE's spokesperson Antonio Hernando confirmed on 5 January that the PSOE would reject the PP's proposal of a grand coalition.

On 30 January, amid discussions between the different party factions on the party congress's date—with those supporting Sánchez seeking to delay it until June and his critics wishing to hold it sooner, in April—an agreement was reached for a new leadership to be elected through a party primary election on 8 May, with Sánchez announcing his will to seek re-election. The party congress to ratify the result of the primaries was scheduled for 20–22 May.

PP scandals
As negotiations for the formation of a new government stagnated, corruption scandals shook Rajoy's party and made it harder for him to secure support for an investiture vote. Two weeks before the election, it was unveiled that PP deputy Pedro Gómez de la Serna had been paid kickbacks worth millions of euros through a business he shared with another PP member, Spain's ambassador to India Gustavo de Arístegui, who resigned shortly thereafter. Gómez de la Serna, who was re-elected as deputy in the 20 December election, refused to vacate his seat, resulting in him being expelled from the PP and forced into the Mixed Group in Congress.

On 22 January 2016, the PP became the first party to ever be judicially charged in a corruption case—a legal figure passed into law by Rajoy's cabinet itself in 2015—after being accused of destroying former treasurer Luis Bárcenas's hard drives in 2013, allegedly containing information related to the party's illegal funding. The same day, a member of deputy prime minister Soraya Sáenz de Santamaría's staff was forced to resign from office after it the unveiling of his involvement in a case of fraudulent awarding of public contracts.

In early February, an illegal financing network was uncovered affecting the Valencian branch of the PP, with dozens of party officials and city councillors either indicted or arrested. Judicial investigation also pointed to former long-time mayor of Valencia and one of the PP's most lauded figures, Rita Barberá, as a participant in the scandal. On 11 February, evidence suggesting that the kickbacks-for-contracts scheme of the Púnica scandal could also involve an illegal financing of the Madrilenian PP led to the resignation of party's regional leader Esperanza Aguirre three days later.

Further scandals affecting the party were unveiled throughout April. The Spanish National Police Corps were sent to register the town hall of Granada—the fourth largest city of Andalusia and nineteenth of Spain—after the city mayor and his government—from the PP—were accused of having been involved in an urban planning corruption scandal. Concurrently, the Spanish Treasury fined former prime minister José María Aznar for evading tax payments through a secret society. Finally on 15 April, interim industry minister José Manuel Soria was found to be involved in the Panama Papers scandal, owing to the leaking of information earlier that week revealing that he and his family had maintained several offshore societies on tax havens during the previous decades. Soria initially claimed the falsehood of such claims, but during the ensuing days reports kept leaking that contradicted his initial clarifications. After it was revealed that he had owned one of such societies on Jersey until 2002 during his term as mayor of Las Palmas, he was put in a critical political position over his confusing and changing explanations on the issue, which ultimately led to his renounce.

Rajoy's withdrawal
On 12 January, PSOE and C's reached an agreement to elect former lehendakari Patxi López as new president of the Congress, leading the PP to reluctantly withdraw its candidate over his lack of support and cast blank ballots instead, whereas Podemos proposed Carolina Bescansa for the post with the support of United Left–Popular Unity (IU–UPeC). The next week, King Felipe VI started a round of talks with the different political parties in order to nominate a candidate for prime minister, but privately acknowledged to party representatives that he thought that a Rajoy's investiture was unlikely. Rajoy initially showed his willingness at attempting an investiture run despite not having any support other than that of his own party, whereas Albert Rivera sought to mediate an agreement between PP and PSOE.

As the round of talks drew to a close on 22 January, Iglesias made a surprise announcement by offering Sánchez to form a coalition government with himself as his deputy, while also laying out a proposal for the future's cabinet composition. Sánchez welcomed the offer but refused to give a formal answer to it, having insisted earlier that "times should be respected" and that Rajoy "should have the first shot", while noting that "policies should come first, then the government's composition". Upon knowing of Iglesias's offer to Sánchez, Rajoy turned down Felipe VI's nomination as candidate on the grounds that there was now "a verified majority against him", arguing that he would not be running "just to let the times die out".

After Rajoy's withdrawal, a new round of talks was announced with Sánchez as the most likely nominee. The PSOE—which had intended for Rajoy to go through a failed investiture in Congress—suddenly found itself obliged to either accept or reject Iglesias's offer, which some PSOE high-ranking members regarded as being aimed at "humiliating" and destabilizing them. Pablo Iglesias celebrated that his proposal had caused Rajoy to step back and urged Sánchez to "rise to the challenge" by accepting it. On the other hand, the PSOE attacked Rajoy and dubbed his decision as "irresponsible" while regarding Podemos's offer as "blackmail". Subsequently, Sánchez also declined to go to an investiture vote until Rajoy made his try or, alternatively, stepped back definitively, though he would later add that he would accept the King's nomination should the PP reject it again. On 2 February, Felipe VI formally tasked him with forming a government, which he accepted.

Sánchez announced that he would try to muster parliamentary support for a successful investiture vote and gave himself a negotiation period of "three weeks to one month". The investiture debate was set to start on 1 March, with the first ballot being scheduled for 2 March and the date of a hypothetical new election being automatically set for 26 June. Rajoy warned against a possible PSOE–Podemos alliance and expressed his wish for Sánchez to fail in his attempt so that he could explore a three-way "moderate" alliance with PSOE and C's to be led by himself. It was reported that the PP favoured going into an early election as the party confirmed that it would vote against any candidate other than Rajoy.

Negotiations and PSOE–C's alliance
After Sánchez's nomination, Podemos and C's expressed their intention to vote against any pact that included each other. Pablo Iglesias asked Sánchez to not seek "impossible pacts" including both of them while insisting on his own offer, whereas Albert Rivera did not rule out the possibility of a PSOE–C's agreement and voiced his wish for the PP to not vote against Sánchez. PSOE started talks with C's, seeking to turn the latter's intended abstention into a "yes" vote, with Rivera not rejecting an eventual incorporation into a PSOE-led government as negotiations progressed. A PSOE–C's pact would have still required further support as it only mustered 130 out of 350 seats, with it being opposed by all three Podemos, Compromís and IU, with whom the PSOE was yet to start talks.

Talks between the PSOE and several minor parties led to an agreement with Canarian Coalition (CCa) on 19 February, with a decision still pending on whether this would materialize in a support vote or in an abstention. Republican Left of Catalonia (ERC) and Democracy and Freedom (DiL) announced that they would oppose a PSOE-led government unless it recognized Catalonia's sovereignty by allowing an independence referendum to be held, something the PSOE rejected. The Basque Nationalist Party (PNV) had already discarded supporting Rajoy and conditioned a support for Sánchez on a new political status being granted for the Basque Country. In January, EH Bildu had hinted at being willing to "get involved in the investiture process" if there was "a real offer of change". The PSOE was said to have offered a cabinet post for IU leader Alberto Garzón in a meeting on 8 February; IU was reported as having rejected the offer, being more concerned about programmatic measures and in preventing "a government of the right-wing", as well as in reaching an understanding with other similarly aligned forces.

On 15 February—and without any formal talks between the two parties having started yet—Podemos publicly outlined a detailed government programme to the PSOE, which included a proposal for a self-determination referendum to be held in Catalonia. Sánchez criticized Iglesias for not having informed him of such proposal first and for "wanting to negotiate through press briefings", rejecting Podemos's document. Iglesias replied by demanding a meeting with Sánchez to tell him what the PSOE wanted to negotiate, with the latter answering that he would only meet Pablo Iglesias "to sign an agreement". Both Iglesias and Mònica Oltra—from Compromís—stated that if PSOE leaders sought to govern alone "they should openly say so", but that "[Sánchez's government] will be a plural one or it won't be". During a European summit on 18 February, Rajoy was recorded telling British prime minister David Cameron that he expected the government formation process to result in a fresh election, noting that he thought that Sánchez would probably lose the vote on 2–4 March.

Through Alberto Garzón's mediation, several meetings were finally agreed between PSOE, Podemos, Compromís and IU, starting on 22 February. Concurrently with those talks, PSOE and C's secretly kept their negotiations ongoing, with a final agreement said to be expected within 24–48 hours. The four-way meeting between the left-aligned parties ended with the most troubling matters being postponed for the next day, but all four were reportedly hopeful of an overall agreement being reached. However, while Podemos reluctantly accepted the PSOE keeping its negotiations with C's, it refused to support Sánchez's investiture if he reached a government agreement with this party.

On the late night of 23 February, PSOE and C's struck a government deal, which was unveiled the next day under the name of "Agreement for a Reformist and Progressive Government" (Acuerdo para un Gobierno reformista y de progreso)—and informally dubbed as the "Pact of El Abrazo" or "The Hug Agreement" (Pacto del Abrazo), in reference to it being signed in the Constitutional Room of the Congress, presided over by a large picture by Juan Genovés named as "El Abrazo" —and which saw both Sánchez and Rivera inviting all other parties "from the left and the right" to join it. It was presented as an "ambitious" programme that comprised constitutional, electoral, social, tax and labour reforms, anti-fraud and anti-corruption measures or a "democratic regeneration" plan—including the enforcement of compulsory party primaries—among others. However, the signed document—which did not clarify whether C's would be entering the government if successful —was revealed to include many points that were contrary to Podemos's election manifesto, such as the absence of a specific repealing of the labour reforms of 2010 and 2012, the explicit opposition to any self-determination referendum in Catalonia and the negation of many of the tax hikes proposed by Podemos, little public investment, a lack of prohibition of the so-called "revolving doors", etc. As a result, all three Podemos, Compromís and IU broke off negotiations with the PSOE on 24 February, amid accusations to the latter of "dishonesty" and putting all talks on hold until after Sánchez's investiture vote. Concurrently, Rajoy said that the pact between PSOE and C's was "useless", noting the shortage of parliamentary support for the alliance and reiterating that the PP would vote against Sánchez's investiture regardless of his choice of partners. Despite these hostilities, the PSOE was still hoping to lure the PNV into the agreement.

On 26–27 February, the PSOE submitted its agreement with C's to the vote of its membership, which approved it by a wide margin (79%–21%), albeit on a 51.7% turnout. The vote received wide criticism for the question's wording, as it was regarded as generic and did not explicitly name either C's or the specific document agreed with them. The result was widely interpreted as an effort from party members to avoid disavowing Sánchez just days ahead of his investiture attempt, rather than genuine support for the pact with C's.

Both signatories soon clashed on the document's interpretation. In an effort to court Podemos, the PSOE claimed that the pact did provide for the repealing of several controversial laws passed during Rajoy's tenure, a claim rejected by C's on the grounds that the written document only mentioned limited modifications on specific issues. Rivera said that he "could not prevent Pedro Sánchez from saying what the accord doesn't state", later adding that his compromise was with the signed document, which initially only provided for C's support to Sánchez's investiture on 2–4 March. C's was said as being willing to probe the possibility of an alternative pact with the PP if Sánchez "crashed" in his attempt. On 29 February, hours before the start of Sánchez's investiture debate, the PSOE sent a last-minute offer to Podemos and the other left-wing parties to collect their support, but Podemos leaders rejected it and accused the PSOE of sending a "copy-paste" of the PSOE–C's document with minor modifications and of ignoring almost all of their demands. C's also questioned Sánchez for trying to unilaterally change their alliance's terms in order to desperately obtain the support of other parties, stating that their pledged support was "for the signed deal only" and that "any changes would have to be reviewed so as to see what stance is adopted by the party".

First investiture attempt
Sánchez's investiture debate was scheduled to start at 16:30 CET (UTC+1) on 1 March with Sánchez's speech, to be followed by the replies of all other parties and a first round of voting on 2 March, with a second and final ballot on 4 March if required. The PNV decided against supporting Sánchez previous to the debate's start, following mutual disagreements over the previous weekend on an alleged PSOE counter-offer—whose precise content was not disclosed—which PNV spokesman Aitor Esteban said to be "so unacceptable" that his party had chosen to arrange it as if no answer had been received. CCa spokeswoman Ana Oramas also announced that she would be opting to abstain on the basis that "there is no credible or viable majority to govern".

In his speech on 1 March, Sánchez outlined a government programme limited to most of the proposals contained in his accord with C's, asking for Podemos to vote for "a government of change", attacking the PP and thanking Rivera's party for their support. He stated that, even if he did not get enough votes for being elected prime minister, he was "proud to have helped unlock the political situation". In his rejoinder the next day, in what was reported as one of his "harshest" speeches ever, Rajoy resorted to sarcasm and aggressive irony and ridiculed the PSOE–C's accord—dubbing it as a "most solemn agreement without the slightest relevance", "a farce", "imposture", "a theatrical representation" or "a vaudeville"—while accusing Sánchez of "trying to stage a personal promotion campaign" ahead of a hypothetical new election and of not having been willing to discuss anything with him, leading to the engagement turning into a mutual exchange of accusations where both Rajoy and Sánchez blamed each other for not allowing the formation of a government. The debate also showed the PSOE and Podemos delving into their differences, with Pablo Iglesias accusing Sánchez and his party of "betraying the Socialist principles" and of "capitulating" to C's. Albert Rivera defended his alliance with the PSOE "despite their mutual differences", addressing the PP's benches—from where several shouts of "traitor" were uttered—and urging them to "have the courage and bravery" to "set aside" Rajoy's era.

With only 131 voting in favour and 219 opposing in the second round of voting, Sánchez's investiture became the first one ever to result in a defeat for the nominee, with his candidacy failing to obtain the required majorities in both ballots. The PSOE had hoped to persuade Podemos into either supporting or abstaining in the second ballot, but gave up on their attempt after the harsh debate between Sánchez and Iglesias. The party did try for others to abstain on the 4 March vote so as to reduce the large number of "no" votes, but only managed to sway CCa into voting for Sánchez as a political gesture with no practical effects whatsoever in the final result.

Investiture aftermath
After Sánchez's failure, King Felipe VI opted to put any further attempts on hold until a workable government proposal was presented to him. Both PSOE and C's showed their willingness to maintain their alliance ahead of future negotiations, announcing that those would be done with both parties simultaneously on the basis of their agreed document, whereas Podemos and IU rejected resuming talks with the PSOE as long as its deal with C's was maintained. The PSOE increasingly saw any kind of agreement with Podemos as "nigh to impossible"—or even desirable—and began readying itself for the hypothesis of a new election. Previously on 5 March, Rajoy had staged what was regarded as his first pre-election rally, asking Sánchez to abstain and let his party govern "as the most-voted one", but acknowledging that the PSOE was unwilling to "come to terms" with him and that he had lost the key support from C's. As a result, political pundits started to point out that the PP was gearing up itself for a new election campaign.

The PSOE suggested that they could withdraw their support from Podemos-held local councils as a way of pressure, to which Iglesias replied that trying to threaten them was "the wrong way to go" and reminding the Socialists that they were also dependent on Podemos's support in several autonomous communities. Concurrently, Rajoy stated on 7 March that he would be calling Sánchez and Rivera to meet them and re-state his idea of a grand coalition. Two days later and pressured by C's, the PSOE agreed to hold a meeting with the PP—a change from their previous approach of refusing to sit down with the PP to negotiate anything—but announced that they would not negotiate the accord's contents and aimed for an unconditional PP's acceptance of them. As a result, the PP rejected the projected meeting over its unwilligness to consent to a PSOE–C's government.

Between 7 and 9 March, Podemos saw the resignations of several members in its Madrilenian regional branch, amid accusations to the party's national leadership of exerting excessive power. Podemos accused the PSOE of attempting to magnify their crisis to pressure them into supporting Sánchez, but the situation aggravated on 15 March after Iglesias unilaterally dismissed Sergio Pascual—the party's organization secretary and close ally to the party's second-in-command Íñigo Errejón. Pascual's dismissal was justified by Iglesias over an alleged "lack of neutrality" in his territorial management, but the move forced Errejón out of public view for two weeks, leading many to speculate about an internal "purge" and a possible power struggle within Podemos between both leaders over the party's stance to Sánchez's investiture, which Errejón was said to favour in order to avoid a new election. After physicist Pablo Echenique was appointed as Pascual's replacement on 2 April, and with Errejón reappearing on 29 March to explain that—despite existing differences—his allegiance to Podemos's project and Iglesias was total, the crisis seemed to alleviate.

The dormant rebellion within the PSOE resumed after Sánchez failed investiture. Some sectors within the party favourable to Sánchez sought to delay the congress that had been scheduled for 8 May as Susana Díaz had allegedly confessed to her close aides that she was determined to dispute the party's leadership. As party members—including Díaz herself—did not see it as desirable to open the issue of succession amid ongoing inter-party negotiations and with a new election looming for 26 June, as decision was taken on 2 April to indefinitely delay the leadership race "until the formation of a new government".

New round of negotiations
Podemos sought to avoid being singled out as responsible for the triggering of a new election by adopting a strategy of rapprochement and reconciliation with the PSOE, with a brief meeting with Sánchez on 30 March leading Iglesias to announce that he was willing to give up the post of deputy prime minister in any prospective PSOE–Podemos coalition government as a way to ease relations between the two parties. Podemos also accepted three-way talks with C's, although the PSOE and Podemos still differed on their visions of the role that Rivera's party should be playing: Podemos still refused to enter or support any government in which C's was directly involved but accepted that they could work together on specific issues, whereas the PSOE maintained its wish for a "broad spectrum government" with the support of all three parties, although without clarifying what kind of government was being sought or which ones of the parties would be part of it. The three parties agreed to hold a meeting on 7 April to start talks.

In the run up to the three-way meeting, C's repeatedly warned that it would terminate its alliance with the PSOE if the latter tried to negotiate with Podemos on its own. Further, the former was seen as distancing itself from the PSOE after abstaining during a parliamentary voting on 5 April involving the paralyzation of the enforcement of Rajoy's education law (the LOMCE), a key issue which had been included within the PSOE–C's agreement. This had seen Pablo Iglesias highlighting the similarities between his party's programme and that of the PSOE while commenting that the two parties' differences with C's made any prospective three-way alliance very difficult. On the day before the meeting, a harsh confrontation between Iglesias and Rivera during a Congress plenary—in which the former told the latter that "it is difficult to agree a progressive government with intolerant people"—evidenced the tense relationship existing between their two parties. On 5 April, C's demanded being given cabinet posts within a PSOE-led government—the first time it did so—and demanded an unconditional Podemos's support to it, in a move seen as a provocation to the latter so that they rejected any agreement with them.

Negotiations came to a standstill after the three-way meeting on 7 April, as PSOE and C's unsuccessfully tried to persuade Podemos to subscribe their accord. C's stated that forming a pact with Podemos was "impossible and unworkable", while the PSOE said that they would not be renouncing their alliance with Rivera's party, pointing to the differences between Podemos and C's as the main obstacle for reaching an agreement. The next day, Pablo Iglesias revealed that it had been C's the one refusing the concessions that Podemos had made in the meeting and that they had been unwilling to accept any kind of involvement from Podemos in any prospective government, also adding that Sánchez had been effectively "kidnapped" by Rivera's party and was unable to negotiate on his own. As a result, Iglesias announced that the PSOE–C's pact would be put to a vote among Podemos's membership on 14–16 April. Subsequently, on 11 April, the PSOE put down any further talks with Podemos on the grounds of a "mistrust" on Iglesias, not seeing any chances for a successful agreement to be reached.

Commentators noted in the wake of the three-way negotiation failure that a PP–PSOE grand coalition was the only viable—even if highly unlikely—option left. Rajoy insisted on his proposal of a coalition based on the existing German model to be led by himself while again rejecting the PSOE–C's accord. The PP also commented on C's arithmetic irrelevance, with contacts between both parties having remained cold-tempered following Rivera's alliance with the PSOE and the harsh Rajoy–Rivera debate during Sánchez's failed investiture. Sánchez expressed a willingness in entering talks with the PP only for the latter to subscribe his pact with C's, stating that the PSOE would "never" support a PP-led government. Sectors within the PP deflected making any offer until Sánchez's acceptance to enter into formal talks, while hinting at him not being the best PSOE "interlocutor" and preferring another person to negotiate with Rajoy so as to "stop the recreation, theaters and games", though it was said that Rajoy would have been willing to have Sánchez as his deputy in a grand coalition scenario. On 11 April, PSOE's spokesperson Antonio Hernando replied to this that "Mr. Rajoy can save any offer for himself, if he had planned in making one".

C's leaders congratulated themselves for "having thwarted a populist government in Spain"—in reference to Podemos's presence within any prospective cabinet—with Albert Rivera reiterating his idea of "an alliance between the main constitutionalist parties". C's started probing a possible pact with the PP, not discarding the possibility of supporting a candidate other than Rajoy, who—under Rivera's view—"was not able to lead a corruption and blackmail-free cabinet" because of his ties to disgraced PP members such as Luis Bárcenas or Rita Barberá—then under investigation for fraud and money laundering. He also warned that his agreement with the PSOE would be "void" in the event of a new election being triggered.

Final positions
Felipe VI had announced a new and final round of talks for 25–26 April to check whether a candidate would be able to muster enough support to be elected. If no nominee emerged, then he would let the deadline expire on 2 May, dissolve the Cortes Generales and call a fresh election for 26 June. Concurrently, Podemos leaders hoped to use the membership vote on the PSOE—C's pact as a way to pressure the PSOE into coming to terms with them, with the unexpectedly high turnout attracting media attention as it exceeded the one in the PSOE's 27 February vote. The vote saw a rejection of the PSOE–C's accord with an 88–12% result and a support to a PSOE–Podemos–Compromís–IU alliance by 92% to 8%.

The landslide result of the vote put down any option for an in extremis agreement, as it showed that neither PSOE nor Podemos were willing to yield to the other's demands. On 21 April, C's leader Albert Rivera called for PP and PSOE leaders to step back and support an independent candidate as prime minister, to which Rajoy replied that Rivera "should do it himself first"—stepping back—while revealing that he would inform the King on his own lack of support because of Sánchez rejection of his grand coalition proposal. On 22 April, economy minister Luis de Guindos was recorded as saying to Eurogroup president Jeroen Dijsselbloem that a new election was all but certain, with the PP hoping that a similar result to December would see "common sense" prevailing and the PSOE reluctantly agreeing to an alliance with them after the summer. Two days later, Rajoy remarked that his party was "ready" for a new electoral campaign and blamed both PSOE and C's for the election repetition, accusing both of "having made [any agreement] impossible".

On 25 April, the King's round of talks turned into a mere formality to certify the failure in negotiations and the triggering of a new election for 26 June. Congress speaker Patxi López had the Cortes's dissolution protocols prepared already from the day the King announced the final round of talks on 12 April, with the dissolution decree having been prepared since at least three days before such round.

Last effort and deadline
On 26 April, Compromís made a last-ditch effort to force left-wing parties into coming to terms, sending PSOE, Podemos and IU a proposal comprising 30-condition agreement "reviewable every six months". The PSOE accepted most of the points but turned down the idea of a coalition, suggesting instead a two-year cabinet headed by Sánchez and including independent members. Compromís leader Mónica Oltra—one of the main promoters of the agreement—replied to the PSOE that their counter-offer was "insulting" because of attempting to buy them into supporting a minority Sánchez cabinet "having just 90 deputies", despite her party having offered "a perfectly-acceptable deal" to "all parties committed to change".

Sánchez conceded that he would not be running for investiture under these conditions and acknowledged that Spain was "doomed to a new election", while putting the blame for it on both PP and Podemos. Pablo Iglesias said that he would have accepted Compromís's offer and that his party had made "enough concessions already", blaming Sánchez for his "unwillingness to negotiate". Rajoy argued that it was better to have a new election rather than seeing any of Sánchez's government attempts succeed. Rivera commented on the proposal that he would not get his party "into last-hour trouble", and that "a three page-long agreement for a four-year government" that was to be formed "by six different parties" was "not even worth looking at". Later that day, Patxi López announced that the King would not be nominating anyone, thus confirming that the Cortes Generales would be dissolved on 2 May.

On 30 April, C's announced that its alliance with the PSOE expired as a result of a new election being called. As a result, some within the PSOE—such as Aragonese president Javier Lambán—urged the party to "abandon" the accord with C's on the eve of the new election once it had proven to be fruitless and counterproductive. The deadline was reached on 2 May, the 11th Legislature of Spain—the shortest in democracy—came to a close and the Cortes Generales were dissolved by the King the following day.

Election aftermath
The June 2016 election resulted in a strengthened PP at the cost of all other national parties, with both the PSOE and C's losing ground—going down from a combined total of 130 seats to 117—and the newly formed Unidos Podemos alliance failing to materialize opinion polling's projections of a second-place score ahead of the PSOE, retaining the same 71 seats obtained by both Podemos and IU separately in December 2015. Overall, the PP's growth allowed for the PP–C's bloc to climb from 163 to 169 seats, whereas the PSOE–Podemos–IU bloc was reduced from 161 to 156; still both blocs remained short of an absolute majority, with the PSOE retaining the same kingmaker position as before.

Mariano Rajoy had expected to resume office and hoped that a government could be formed quickly, adding that "It would be nonsense to lose time for several more months". In order to court them in, he made an offer for starting coalition negotiations with both PSOE and C's which the former rejected. With the PSOE in the opposition camp, a hypothetical PP and C's alliance would require the complicated support of regional parties, which C's leader Albert Rivera was unwilling to accept as he stressed that his preferred choice was forming a coalition government with both PP and PSOE without Rajoy at its helm. As this proposal went unheeded, Rivera acknowledged its failure on 4 July and added that his party would go into opposition, forcing the PP to seek out the PSOE's abstention in order to form a minority cabinet.

The PSOE ruled out trying to lead government negotiations again and rejected an invitation from Unidos Podemos to do so, with some members instead favouring the party to abstain in Rajoy's investiture in exchange of a series of conditions, with the ultimate goal of preventing a third election in a row. Among those supporting this was former prime minister Felipe González, who nonetheless rejected a grand coalition between both parties and stated that the PSOE had to "take its place as a responsible opposition" and focus on "rebuilding its own project as an alternative". The PSOE leadership disregarding González's statements stated that the party's stance would be to vote against Rajoy's investiture, despite the PP having offered to reach a "minimum deal" to unlock the situation rather than a full-fledged accord.

First contacts
The PP immediately started probing political parties in search of support for Rajoy's investiture. CCa did not rule out supporting a Rajoy-led cabinet, whereas the PNV demanded a number of conditions such as further devolution for the Basque Country, the recognition of Spain's national diversity and the rehabilitation and reintegration of ETA prisoners, moves which would have meant drastic changes in PP policy. After a meeting with Rajoy on 6 July to discuss this offer, PNV spokesperson Aitor Esteban claimed that they were both "absolutely away" and confirmed that his party would be voting against Rajoy unless a "change of attitude" was perceived.

On 9 July, Sánchez announced that his party would be voting against Rajoy's investiture, asking the prime minister to look for a parliamentary majority without the PSOE. Unidos Podemos sought to ease the chances for the formation of an alternative government to Rajoy and sought PSOE's support to it but this possibility was rejected by Sánchez, who preferred to go into opposition. Several PSOE leaders proposed that other parties participate in a "joint abstention" in Rajoy's investiture, appealing to the "collective responsibility of all parties" for the institutional impasse—with the goal of preventing a third general election but, at the same time, avoiding their party bearing the brunt of the responsibility for allowing Rajoy's election —but Unidos Podemos quickly dismissed this proposal as "cowardice". As Rajoy clashed with the PSOE's harsher-than-expected stance towards him, he scheduled a meeting with Sánchez for 13 July, where the former warned the Socialists that either they gave up and allowed a PP minority government or a third election would be the only way out.

Unidos Podemos and C's leaders Pablo Iglesias and Albert Rivera met Rajoy on 12 July as part of the latter's contacts with political parties. Rivera hinted at being willing to abstain in Rajoy's investiture—initially expected to be held at some point in late July or early August—as an attempt to pressure the PSOE into doing likewise and allowing for a government to be formed, in what was seen as a change in the party's main election pledge not to allow Rajoy to remain in office. The next day, C's confirmed its change of position and announced that it would be voting against Rajoy in the first ballot of investiture but would abstain in the second ballot, in which Rajoy would only require of a simple majority to be elected. On the other hand, Iglesias noted Rajoy on Podemos's political project incompatibility with that of the PP and that Rajoy should expect nothing but the frontal opposition of his party to the investiture, while once again urging Sánchez to take the initiative and try to form an alternative government himself as the PSOE had to choose "between Rajoy, a leftist alternative or a new election".

On 18 July, PP and C's reached an agreement for electing the Congress bureau and having Patxi López replaced by development minister Ana Pastor as the Speaker, whereas Unidos Podemos planned to have En Comú Podem's spokesperson Xavier Domènech run for the post. As a result, Pastor was elected as new president of the Congress in the second ballot, in which Unidos Podemos's deputies voted for López as a political gesture, and owing to the regionalist and nationalist parties in the chamber having chosen to cast blank ballots rather than supporting any one of the main candidates.

The election of the Congress bureau—which was conducted through secret ballot—would see some controversy as a result of the composition designed by PP and Cs being supported by an additional 10 votes of unknown origin, which resulted in the PP's candidate for the Congress's third vice presidency, Rosa Romero, being elected over Podemos's candidate Gloria Elizo. As PSOE and Podemos had each voted for their own candidates without any missing ballots, both parties accused the PDeCAT and PNV from having surreptitiously lent their votes to the PP to ensure that Elizo was not elected.

Rajoy's acceptance
On 28 July, the King tasked Rajoy with forming a government, which the latter accepted without clarifying whether he would actually submit himself to an investiture vote. The PSOE, PDeCAT and PNV, which were in the spotlight because of them being the likeliest arithmetical choices for allowing a minority PP government, announced their intention to oppose Rajoy's investiture. C's leader Albert Rivera, who had initially shown an unwillingness to move from his party's position of abstaining, announced on 9 August that he would be willing to consider negotiating a "Yes" in Rajoy's investiture in exchange of a number of conditions, one immediate—that a date was set for the investiture to take place—and other six that were to be enforced in the first three months of government, namely: that those accused of political corruption were separated from public offices, the approval of a legal reform removing immunities from public officers, electoral reform, the suppression of pardons in cases of political corruption, that a two-term limit was set for the prime minister and that a parliamentary committee was set up to investigate the ongoing PP corruption scandals. Earlier, PP officials had stated that they were willing to offer "anything" but Rajoy's permanence to C's in exchange for their support in the investiture and welcomed Rivera's new stance. Rajoy himself stated that his party would study Rivera's conditions and would give an answer after a meeting of the PP executive committee the following week.

On 17 August, Rajoy announced his willingness to hold negotiation talks with C's but initially ignored Rivera's conditions, instead scheduling a meeting between the two leaders the following day to discuss them. This ultimately led to Rajoy accepting all seven conditions and in both parties agreeing to start negotiations, but warning that even with the support of both of them and CCa—with whom the PP was maintaining talks—the 170 votes they would muster would still not be enough to overcome the predicted 180 negative votes from all other parties combined. The investiture debate was set to start on 30 August, with the first and second rounds of voting scheduled for 31 August and 2 September; this would mean that, in the event of Rajoy failing to secure the required support to be elected, the parliament's dissolution date would be automatically set for 31 October and a new election scheduled for Christmas Day, 25 December 2016. Both PP and C's tried to use the possibility of a third election as leverage to increase political pressure on Pedro Sánchez, calling for him to choose whether he wanted people to "go out to vote on 25 December" or to choose "a responsible abstention that allows government formation".

Negotiations and PP–C's pact
Negotiations between the PP and C's started on 22 August with early advances on economic issues, but the PP's initial aim to try to persuade C's into a government coalition failed over the latter's reluctance, disagreements in labour affairs and the little time left before the investiture debate. C's came under criticism after it transpired that the party had accepted redefining the crime of political corruption by limiting it to cases of illegal personal enrichment or irregular funding, in what was seen as a major concession from Rivera's party at a time when many PP members were involved in a number of corruption scandals and the party itself was placed under judicial investigation. On 24 August, C's members recognized that negotiations were tough and that they were "worried" in what they perceived as "a lack of political will [from the PP] to undertake reforms". The next day, C's announced a 48-hour ultimatum to the PP for an agreement to be reached as negotiations had come to a standstill, demanding the PP commit itself to specific reforms and to clarify spending figures. From that point, negotiations between the two parties resumed, even if "insufficient at times" according to C's.

On 28 August, a deal was struck between PP and C's, with separate negotiations between PP and CCa also leading to the latter to support Rajoy's investiture. The PP–C's accord contained 150 programmatic measures to be applied on the condition that Rajoy was re-elected as prime minister, which included a number of social measures (such as the equalization and extension of parental leaves, a guaranteed salary commitment for families with lower incomes, increased spending on Education, Health and Dependency and a €5.68 billion plan against child poverty); recovery of lost money through the 2012 fiscal amnesty by raising the tax payment from the final 3% to the initially scheduled 10%—resulting in a predicted gain worth €2.8 billion; a new labour reform providing for three types of contracts (one indefinite, one "of increasing protection" for coverage of fixed-term jobs and another for employees "in training"); depoliticization of the judiciary through the direct election of 12 out of 20 members in the CGPJ by judges and magistrates; reduction of spending for provincial deputations and the Senate; an unspecified reform of the electoral municipal law to directly elect mayors; a number of compromises on taxes (such as not raising PIT, a lowering of culture VAT limited to live entertainment, a reform of the corporate tax to remove deductions to large companies and removal of the 'Sun Tax', applied to systems that used batteries to store the sun's power). The accord also included 100 proposals that had been present in the defunct PSOE–C's deal in an attempt to court the Socialists into allowing the investiture to pass, but this was to be of little avail as Sánchez's stance remained unchanged.

Podemos criticized the accord and accused Rivera of "selling himself out for free" to Rajoy, claiming the PP was using C's "like chewing gum to plug their holes". On the other hand, the PNV assured their stance would remain opposite to Rajoy's election, both before and after the Basque regional election scheduled for 25 September; whereas the PDeCAT saw the signed accord as "anti-Catalan" and maintained its opposition as well, noting to both PP and C's that they still lacked the votes to pass the investiture. Rajoy stated that he would "keep trying" despite acknowledging that the ultimate choice on whether he would end up becoming prime minister was dependent on the PSOE.

Second investiture attempt
Mariano Rajoy's investiture debate started on 30 August at 16:00 CEST (UTC+2) with Rajoy's speech, to be followed the next day by the replies of all other parties and the first round of voting; if necessary, a second and final round was scheduled for 2 September.

Sánchez kept his opposition to allowing the PP into government in a debate which, nonetheless, revolved on the ongoing discussions within the PSOE on what its stance would be following Rajoy's failed investiture attempt. In a reversal of the roles in Sánchez's failed investiture in March, the PSOE leader wanted to convey a harsh stance to Rajoy's election by assuring he would never allow it to happen, without clarifying whether he would try to explore an alternative himself. Rajoy mockingly undervalued Sánchez's reasons to vote against him before asking Sánchez to just "let him govern", dismissing any possible alternative government to his as unworkable. Pablo Iglesias called out for Sánchez to "make up his mind" and to agree on exploring a joint government "despite the enormous differences, grievances and mutual mistrust between the PSOE and Podemos", as Podemos would be "a trustworthy partner against the PP"—pointing out to C's having abandoned him to support Rajoy —but also told him that "if [his] personal bet is on a third election, [he] should openly say so".

Albert Rivera defended his pact out of the convenience to unlock the parliamentary deadlock while warning Rajoy that his party "still did not trust him", but that it would rather "demand, enforce and oversee the doings of those who have to govern" and called out for Sánchez to not being an obstacle for the country's governability, inviting him to "enforce laws from opposition". Neither Rivera nor Rajoy did an enthusiastic defense of their accord—with the latter even claiming that it would not "go down in history"—rather defending it out of the need to have a fully functional government as soon as possible.

With 170 votes in favour and 180 against, Rajoy became the first caretaker prime minister to be defeated in an investiture ballot on 31 August, and again with the same result in the second round on 2 September. PP and C's clashed after Rivera suggested to end their accord if the PP did not propose "another, more electable candidate" instead of Rajoy, with Rajoy's party recriminating Rivera that "we do not sign agreements for 15 minutes". Meanwhile, Sánchez ambiguously hinted that he could attempt to lead an alternative government himself without clarifying how would he set it up. After the failed investiture, the parties refrained from any new negotiation attempts until after the Basque and Galician elections scheduled for 25 September, with the King not holding any new round of talks until after that date in order to avoid interfering with the electoral campaigns.

PSOE crisis and Sánchez's ouster
Internal criticism of PSOE secretary-general Pedro Sánchez for his hardline stance on Rajoy's investiture—said to be a contributing factor to the political deadlock—had been kept at bay by the party's performances in the 2015 and 2016 general elections, where despite securing its two worst election results since 1977 the party held its own against Podemos's push, averting the threats from Sánchez's critics—who had hoped to hold him to account for a hypothetical electoral collapse—from materializing. However, the poor party showing in the 25 September Basque and Galician regional elections provided the pretext for dissenters—led by Susana Díaz—to call for Sánchez's immediate resignation the next day, to which the latter replied by surprisingly announcing a primary election for October and daring any challenger to come out and dispute the post to him. The internal movements within the PSOE were seen positively by Rajoy, who was said to be "waiting for the PSOE to kill off Sánchez" in the hopes that a new leadership could lead the party to reconsider its abstention in a new investiture voting.

On 27 September, signs of a breakdown in party discipline became evident: Susana Díaz publicly voiced her willingness at becoming the party's new secretary-general, with a majority of members within the party's parliamentary group in the Congress of Deputies voicing their opposition to Sánchez's plans of holding an express leadership election amid the ongoing government formation process and with a general election looming for December. Former Socialist prime minister Felipe González added to the pressure by declaring that he felt "deceived" by Sánchez because of the latter having allegedly promised him to abstain in Rajoy's investiture. This led to the resignation of 17 out of the 35 members from the party's executive committee on 28 September, in a move aimed at triggering Sánchez's own resignation. Sánchez refused to resign, prompting the party to descend into chaos.

Sánchez barricaded himself within the party's headquarters in Madrid and accused rebels of "staging a coup", whereas his critics proclaimed that they were now in control and demanded a caretaker committee to lead the party in the interim. Susana Díaz criticized Sánchez's record and accused him of seeking a congress "out of personal interest", offering herself to unite the party and hold a leadership election "in due course" once the political deadlock in Spain had been resolved. Further chaos ensued within a meeting of the party's federal committee on 1 October, as disagreements between the two factions on the assembly's agenda and voting census delayed its start by several hours. Sánchez repeatedly blocked Díaz's attempts to hold a vote on his post as the two sides failed to agree on the committee's purpose, with him trying to force a secret ballot on his proposal for a party congress that was suspended amid accusations of vote rigging by critics because of the ballot box being "hidden" and "unsupervised". This action was said to have cost Sánchez the support of some of his allies, and in a subsequent voting on Sánchez's proposal turned into a vote of confidence on him—this time by a show of hands—he lost it by 132 to 107, prompting him to resign as PSOE secretary-general and allowing Díaz's supporters to take over the shattered party.

Reactions to Sánchez's resignation were mixed. Pablo Iglesias commented that "supporters of a PP government have gained the upper hand within the PSOE" and called for opponents to Sánchez's ouster to rally behind Podemos as the only remaining leftist alternative in Spain to a Rajoy-led government, whereas Albert Rivera praised Susana Díaz's move and called for the PSOE to "help form a government". With the rebel faction taking over the party, political relations with Podemos were expected to strain, as Sánchez's critics had considered an abstention in a potential forthcoming vote on Rajoy's investiture as the only way out of the deadlock and to avoid a third general election in a row. Concurrently, the party's fracture shutted down any possibility of an alternative government to the PP's one being formed, and left it at the mercy of Mariano Rajoy, who subsequently began to push for conditions himself in exchange for avoiding a third election which the PSOE could not afford in its current state.

Split on investiture
President of Asturias Javier Fernández was appointed to chair the caretaker committee that would lead the party in the ensuing months. He acknowledged that the PSOE had to decide whether to abstain on Rajoy's investiture or risk a third election being held, aware that a revolt could break out within the party's parliamentary group if they opted to allow Rajoy to govern. Despite internal discontent from a number of MPs who refused to be held responsible for the formation of a new PP government, as well as threats from the Socialists' Party of Catalonia (PSC)—PSOE's sister party in Catalonia—to break party discipline, Fernández maintained that deputies would not be allowed a free vote, whereas Susana Díaz's PSOE–A called for the parliamentary group to vote as a bloc according to the decision taken in a new federal committee that was scheduled for 23 October, suggesting that MPs refusing to abide by such decision should resign their seats.

As opinion polls conducted after the party crisis indicated a fall in support for PSOE, advocates of abstention argued that the question was no longer whether Rajoy would become prime minister again, but whether he would be elected "now" or after a third election predicted to result in a landslide win for the PP. The party's caretaker leadership was confident of being able to win the argument in favour of abstention, but they were also concerned that this move would widen the existing divisions within the party. Finally, the party's federal committee voted on 23 October to abstain unconditionally once the Congress considered Rajoy's candidacy for a second time,  but some deputies declared that they would not abide by the committee's decision and would oppose Rajoy's investiture nonetheless. King Felipe VI scheduled a new round of talks for 24 and 25 October, ahead of 31 October deadline, with a new investiture hearing set for 26–29 October upon confirmation that Rajoy had sufficient support to win the vote.

Calls from some PSOE members for Fernández to allow a "minimum abstention" of just eleven MPs were rejected by the party's interim leadership, as a growing dispute between the PSOE and the PSC over the issue endangered the political alliance existing between the two parties since 1978, as the former also threatened any rebels with outright expulsion from the parliamentary group. Still, and despite threats of retaliation, a total of 18 MPs had indicated by 25 October that they were willing to vote against Rajoy regardless of any consequences, with a further three considering it "because of the threats made by the management committee's". The PSC formally ratified their intention to vote against Rajoy's investiture later that day, to which the PSOE replied by warning that such a decision would represent "a unilateral breach" of the relationship between the two parties.

Third investiture attempt
A new investiture session began on 26 October at 18:00 CEST (UTC+2) with the speech from Mariano Rajoy in the Congress of Deputies, to be followed on 27 October by the replies from the other parties, a first round of voting later that day and, if necessary, a second round scheduled for 29 October. Rajoy's speech praised the PSOE's new stance on his investiture and called on them to maintain their "responsibility" ahead of future agreement between the two parties that ensured political stability. Antonio Hernando, PSOE's spokesperson in Congress, justified their abstention by citing the country's need for a government after months of deadlock, but reiterating that his party still did not trust Rajoy and promising to provide a strong opposition to his policies regardless.

Pablo Iglesias harshly condemned the PSOE's decision to allow Rajoy's investiture, suggesting that it heralded the effective end of the two-party system that had dominated Spanish politics since the adoption of the 1978 Constitution and accusing Rajoy of having sacrificed turnismo—in reference to the historical rotation of PP and PSOE in power—by "bumping off" the PSOE and relegating it to a mere PP "crutch" in order to save himself and his party. Iglesias also declared that Unidos Podemos would be the main force of opposition against the alleged "triple alliance" of PP, PSOE and C's that supported Rajoy. Concurrently, and despite having announced the end of his pact with PP after the previous investiture debate in early September, Albert Rivera pledged to repeat his party's affirmative vote for Rajoy's investiture in exchange for the agreed reforms and to put an end to the political deadlock, while also condemning Iglesias's support of the street protests taking place outside the Congress in protest against the PSOE's abstention.

The debate was also notable for being the first public appearance of Pedro Sánchez since his resignation as the PSOE's secretary-general, as he kept his seat in Congress and attended the investiture session; asked about his stance in the two rounds of voting, he confirmed that he would be voting "no" in Thursday's ballot—in which the PSOE was expected to symbolically oppose Rajoy—but did not disclose his intentions ahead of Saturday's ballot, when his party would abstain. Sánchez and his supporters within the Socialist parliamentary group did not applaud Hernando's speech, describing it as "disappointing", whereas some of those critical of the PSOE's new direction commented that they risked losing the leadership of the opposition to Podemos following Iglesias's speech.

As scheduled, Rajoy lost the first ballot on 27 October by 180 to 170, with the PSOE abstention having been inconsequential at that time since an absolute majority was required to succeed in the ballot. Attention then turned to Saturday's second and final ballot; of particular interest were the extent of the PSOE's parliamentary schism and Sánchez's final voting position, with close aides suggesting that he would not abstain. Ultimately, a visibly emotional Sánchez announced his resignation as deputy a few hours ahead of the scheduled vote, arguing that he could neither abstain—which would have meant breaking his electoral pledge of opposing a PP government—or, as a former PSOE leader, set a negative precedent by disobeying the decision of the highest party governing body, the federal committee, while hinting at the possibility of that he may run in a future party leadership election.

On 29 October, Rajoy succeeded in his investiture attempt with the support of 170 MPs to 111 against and 68 abstentions, thus ending the 10-month political deadlock. Fifteen PSOE deputies chose to break party discipline and vote against Rajoy in spite of the possible consequences threatened by the party's interim leadership. During the investiture debate, thousands gathered outside Congress to protest against what they described as a "coup", shouting slogans against both PP and PSOE, with some protestors describing the new government as "illegitimate" in view of it being born out of a political U-turn. Rajoy reiterated his wish for "a government that was able to govern", calling for those parties facilitating his election—PSOE and C's—to ensure the parliamentary stability of his cabinet through confidence and supply, whereas Iglesias attacked the Socialists for their "capitulation" and claimed for himself and his party the "hegemony of opposition" to the PP government.

Aftermath
Spain's -day political stalemate ended with Rajoy's election as prime minister, after a period which saw some of the most dramatic political upheaval since the country's return to democracy: two inconclusive general elections, two failed investiture attempts, Podemos and IU teaming up together, Pedro Sánchez's ouster as PSOE leader and his party torn apart by internal strife as it allowed the formation of a right-wing government for the first time in its history.

Following the successful investiture and on the eve of the establishment of the second government of Mariano Rajoy, in an exclusive interview for laSexta's Salvados news show, Sánchez publicly accused his party's apparatus—led by Susana Díaz—and "financial powers", including media outlet El País, of having coerced him into avoiding a left-wing pact with Podemos and nationalist parties throughout the entire government formation process, revealing they triggered the internal revolt within PSOE to oust him once he considered a serious attempt at forming such a government and after repeatedly opposing to allow a PP government to form.

Rajoy's election would later be regarded by political analysts as a tactical solution to overcome the impasse and not as a true expression of parliamentary confidence. Without an overall majority in a hostile parliament and relying on a traumatic abstention from the main opposition party, Rajoy's government would remain in place for as long as the PSOE and the remaining parties did not come together to add their votes. This proved true in June 2018 when—with the publication of the court ruling on the Gürtel case as a trigger—Mariano Rajoy was expelled from office in the first successful motion of no confidence in Spain since the country's transition to democracy, allowing Pedro Sánchez (who had been re-elected at the helm of the PSOE's leadership in June 2017) to become prime minister.