Pedro Sanchez, head of Spain's Socialist Party, has resigned in an intra-party dispute over whether to support a conservative-led governing coalition.
Sanchez's decision to quit on Saturday could pave the way for a new government, which Spain has sought for almost nine months.
"I have announced ... the resignation of the federal executive committee and also my resignation as secretary-general," he told reporters.
Sanchez made the decision to quit after he lost a vote over his opposition to allow acting Prime Minister Mariano Rajoy of the conservative People's Party to form a government. Sanchez' opposition to a Rajoy-led government had bitterly split the Socialist Party.
In September, parliament rejected Rajoy's latest attempt to win a confidence vote to form a new government, edging Spain closer to its third election in a year.
Rajoy was buoyed a week ago by his party's success in provincial elections in his home region of Galicia, where the People's Party have held power for the past four years.
The party will now be run by an interim executive, which may direct its politicians to abstain in a parliamentary vote of confidence on a Rajoy-led government, instead of voting against it as they did last month under Sanchez's guidance, prompting its failure.
All eyes will now be on what the interim executive announces, and whether Rajoy decides to submit his minority government to another vote of confidence.
But whatever the outcome, analysts and party members say the damage to the Socialist Party may be long-lasting.
Spain's parliament has until October 31 to produce a government or new elections will be called in December - the third in a year.