But the deal announced on Tuesday still won't provide enough votes in parliament for the Socialists, who won Sunday's election, to take office without the support of other parties.
The leaders of Spain’s Socialist party and the left-wing United We Can party say on Tuesday they have reached a preliminary agreement about forming a coalition government.
Incumbent Prime Minister Pedro Sanchez's left-of-centre Socialists captured 120 seats in Sunday's ballot but fell far short of a majority in the 350-seat chamber. United We Can got 35 seats.
In a joint appearance, Sanchez and United We Can leader Pablo Iglesias say under the deal Sanchez would be prime minister and Iglesias his deputy in a future government.
They will also hold talks with other parties to get more support.
Meanwhile, Catalonia's separatist-dominated parliament drew a fresh rebuke from Spain on Tuesday after approving a text in favour of self-determination, despite it being suspended just minutes earlier by the Constitutional Court.
Although such resolutions by the Catalan Parliament are purely symbolic — the chamber not having the authority to make such decisions — they have been routinely overruled by the Spanish courts.
But the move could have legal consequences for regional parliament speaker Roger Torrent, who has received repeated legal warnings not to allow such initiatives.
Passing the motion was the latest in a string of moves by separatists in this wealthy northeastern region, which has been rocked by protests since mid-October when Spain jailed nine of its leaders over a failed secession bid.
Approved with the support of the three separatist parties in the chamber, the text refers to the desire "to tangibly exercise the right to self-determination and to respect the will of the Catalan people."
The time of the debate was brought forward in a bid to avoid the expected censure of Spain's Constitutional Court.
The court suspended the resolution just minutes before the vote in the Catalan Parliament, but lawmakers went ahead anyway.
Since September 2015, when separatist lawmakers won a majority in the regional parliament, the Constitutional Court has routinely suspended every motion aimed at advancing independence.
Separatist parties have pushed ahead regardless, insisting on their parliamentary right to debate anything, and in September 2017, they passed a law paving the way for an independence referendum on October 1, despite the court declaring it unconstitutional.
After a violence-marred vote, they issued a short-lived declaration of independence, prompting Madrid to sack the Catalan government, suspend the region's autonomy and put their leaders on trial.
One of the defendants was former parliamentary speaker Carme Forcadell, who was accused of ignoring legal warnings about pushing through laws that laid the groundwork for the referendum and for secession.
Last month, the 64-year-old was convicted of sedition and sentenced to 11 years and six months behind bars. Eight others were also handed lengthy jail terms.
Ahead of the October 14 verdict, the Catalan Parliament again adopted a clutch of motions granting legitimacy to civil disobedience, demanding the withdrawal of Spanish police from the region, and calling for amnesty for its leaders.