Spain's socialists said on Saturday they were confident of reaching a government agreement with the far-left Podemos party that will pave the way for acting prime minister Pedro Sanchez to be sworn in by parliament this week.
PSOE's Sanchez, who won the most seats but fell short of a majority at the April election, hopes to be sworn in as prime minister, but even with Podemos's support he will still need some extra votes from other parties.
After days of increasing confrontation and stalled power-sharing talks, negotiations between the two parties reached a turning-point on Friday. The leader of Podemos, Pablo Iglesias, said he was willing to give up having a post in a coalition government, accepting a key condition of Sanchez.
"Now I am convinced that there will be an agreement. The party is (too)," PSOE deputy secretary general Adriana Lastra told reporters. "That's what we are going to be working on in the next hours, days ... with the goal that this countrywill have a fully functioning government."
An alliance between PSOE and Podemos would bring Sanchez almost within touching distance of the parliamentary majority he needs. The parliamentary debate starts on Monday ahead of the first confirmation vote, scheduled for around 6pm Spanish time on Tuesday.
Sanchez needs to win an absolute majority of at least 176 votes. If that fails, within two days he must seek a simple majority - where more members of Congress back him than oppose him or abstain - in order to be able to form the next government.
If he loses that vote, a two-month countdown will begin until a new election is held.
Podemos want some key ministerial portfolios in any coalition government, but Sanchez has offered only lower-ranking posts, although he has opened the door to accept Podemos members in a coalition government.