Spain election: King asks Socialist Sanchez to form government
Pedro Sanchez of the Spanish Socialists (PSOE) has been asked by King Felipe VI to try to form a government, after December's inconclusive polls.
His party came second but acting Prime Minister Mariano Rajoy was unable to form a coalition after failing to secure a parliamentary majority.
Two new parties, the radical left Podemos and the centrist Ciudadanos, made big gains in the December vote.
Along with smaller regional parties, they hold the balance of power.
Announcing his acceptance, Mr Sanchez said talks would begin on Wednesday with all parties on forming a coalition to create a "stable government backed by constitutional forces".
It would be a government of change, he said, that was "progressive and reformist", which appeared to suggest that Mr Rajoy's centre-right Popular Party (PP) was unlikely to be invited. A PSOE spokesman told Spanish radio on Wednesday that talks would be conducted in an "immediate, public and transparent manner".
The PP won 123 seats to 90 for the PSOE, 69 for Podemos and 40 for Ciudadanos, in the 350-seat parliament.
But the Socialist leader rejected Mr Rajoy's offer of a grand coalition deal involving the two parties.
Without the PP, Mr Sanchez would need the support of both Podemos and at least one more party to obtain the required 176 seats to obtain a working majority in parliament.
However there are sharp differences between Podemos and Ciudadanos. The radical left party's leader, Pablo Iglesias, has ruled out any kind of pact with the centrist party.
The Socialists, meanwhile, are opposed to Podemos's plans for a referendum on independence in the restive Catalonia region.
If no working government can be formed, a fresh general election will be called.
Last month, Mr Rajoy turned down an offer by King Felipe to be the first candidate to try to form a government, saying he did not have the support to win a confidence vote in parliament.
It is the first time in 40 years that the monarch has had such an influential role after an election. For decades the PP and PSOE alternated in power with secure majorities.
The former King, Juan Carlos, oversaw Spain's democratic transition after the death of nationalist dictator General Francisco Franco in 1975.