"I am putting forward Mr Pedro Sanchez Perez-Castejon as candidate for prime minister," King Felipe VI said in a statement read out by parliamentary speaker Patxi Lopez.
The country has been mired in uncertainty since December polls saw the incumbent conservative PP win most seats but fall short of an absolute majority as voters flocked to two upstart political groupings, ending Spain's long-established two-party system and creating a deeply fragmented parliament.
Acting Prime Minister Mariano Rajoy struggled to form a government as other parties consistently refused to support him, citing inequalities created by drastic spending cuts implemented during his four-year term, as well as corruption scandals afflicting the PP.
As it became increasingly obvious that Rajoy would not succeed, the king - who traditionally nominates a candidate for prime minister following elections - decided to pick Sanchez, whose Socialist party (PSOE) came second in the polls.
But Sanchez faces an uphill struggle to succeed where Rajoy failed, as he will have to sit down with conflicting parties to try and form an alliance acceptable to his own divided grouping that will also give him enough seats to push his government through.
In a press conference after the announcement, the 43-year-old former economics professor told reporters that the PSOE - which won 90 parliamentary seats - stood ready to drag Spain out of its current quagmire.
He said he would talk to all political groupings, but "in the type of government that I am contemplating, the PP doesn't have its place."
Rajoy had initially wanted to form a "grand coalition" consisting of the PP - which won 119 seats - the PSOE and upstart centrist grouping Ciudadanos, which came in fourth place with 40 seats, but Sanchez repeatedly rejected the idea.
The formation of a left-wing coalition government that would include anti-austerity party Podemos, which came third in the polls, has regularly been touted.
Last month, Sanchez went to Portugal to meet Prime Minister Antonio Costa, whose far-left coalition brought down the ruling conservatives in Lisbon last year, in a sign he may be considering the same sort of scenario.
Podemos, a close ally of Greece's Syriza, has said it is open to the idea but Sanchez has responded that the two parties first need to reach an agreement on a programme.
The formation of such a coalition has been complicated by Podemos' backing for an independence referendum in the wealthy northeastern region of Catalonia that is seeking to break away from Spain -- which the Socialists fiercely oppose.
And in any case, Sanchez had insisted all along that he would only start negotiations to form a government if the king nominated him - a move that angered Podemos leader Pablo Iglesias.
"I don't understand how you can make the Spaniards wait in this way," he said Tuesday.
The complex parliamentary arithmetic also mean that the Socialists will almost certainly have to count on the support of Catalan nationalists that also won seats, with whom Sanchez does not want to negotiate.
In his press conference, Sanchez said it was time "to talk about what we can do in a united manner."
He put forward a series of proposals that the Socialists want to implement, such as bettering working conditions, improving the country's education and health systems and fighting corruption.
By Marianne Barriaux / AFP