King Felipe VI has asked caretaker Prime Minister Pedro Sánchez to try to form a government, after his conservative rival was unable to.
The Socialist leader said he would meet every political party bar the far right in a bid to have a second term.
Ever since he came runner-up in July elections, it seemed almost certain he would have the better chance of forming a majority than Alberto Núñez Feijóo.
It has also been obvious he would need the backing of Catalan nationalists.
Without the parliamentary backing of the pro-independence Together for Catalonia (JxCat) and Catalan Republican Left (ERC), Mr Sánchez would fall short of the 176 seats he needs for a majority, triggering a repeat election.
"I am ready to work to form, as soon as possible, a progressive coalition government between the Socialist Party and [left-wing coalition] Sumar with sufficient parliamentary support to guarantee the stability that the country needs," he said.
He now has until 27 November to find enough support for an investiture vote in parliament and will start talking to political groups on Wednesday.
Alberto Núñez Feijóo's conservative Popular Party won the 23 July vote, but he could only secure 172 votes in parliament last week, four short of a majority.
Pedro Sánchez, in power since 2018, has a chance of getting the right numbers, at a price.
He will be able to secure the support of Sumar and Basque regional parties, but the two Catalan pro-independence groups have made clear they want an amnesty for separatists accused over a 2017 bid for independence.
JxCat's seven MPs are seeking an amnesty for leader Carles Puigdemont, who spearheaded the push for independence and fled to Belgium to escape prosecution.
Mr Sánchez has made substantial concessions to the independence movement in the past, such as granting pardons to nine jailed Catalan leaders in 2021 and more recently reforming the criminal code to remove the crime of sedition.
Those moves drew a severe backlash from the opposition, but ultimately did not appear to harm him substantially in the polls.
However, an amnesty is seen as a much bigger step and the last such law was approved in 1977, as part of Spain's transition to democracy.
Already several veteran figures in Sánchez's own party, PSOE, have spoken out against the proposal, deeming it unconstitutional and a threat to Spain's territorial unity. In the past, Mr Sánchez's own government had deemed an amnesty unconstitutional.
The caretaker prime minister avoided the word "amnesty" on Tuesday, saying only that he would be "generous" to Catalonia's separatists, but he has made clear he will not support a secession referendum, demanded by both JxCat and ERC.
A recent poll by La Razón newspaper stated that more than 80% of Spaniards oppose an amnesty, with almost the same percentage of Socialist voters taking the same stance.
Mr Sánchez will argue that pushing ahead with such a controversial initiative will further improve the atmosphere in Catalonia, where tensions have already dropped substantially since the failed secession bid.
Also, if it allows him to form a new coalition administration, left-wing voters will be hearted by the fact it could ensure that the country's conservatives and far-right Vox party are kept out of government for another legislature.
If he fails to form a government, Spaniards are likely to return to the ballot box in January.