The legislature has been mired in deadlock since an inconclusive election in April which the Socialists won but without a majority - in an outcome that was repeated on Sunday.
Sanchez called Sunday's election in the hope of strengthening his hand after months of negotiations between the Socialists and Podemos failed to reach a deal - a gamble that ultimately failed.
Announcing the new tentative deal, Sanchez said the aim was to break months of political deadlock.
"Our desire is to achieve majority support in the chamber," he said, indicating they would approach other factions "to achieve a stable and sustained majority that would make possible not only an investiture vote but a legislature".
Standing next to him, pony-tailed Podemos leader Pablo Iglesias said they wanted to form "a progressive coalition government" and would thrash out the details of both its programme and structure in the coming weeks. "As election night showed... what was a historic opportunity in April has become a historic necessity," he said of an election which showed a definite shift to the right.
Both the Socialists and Podemos lost seats compared to the April election, with Sanchez's party taking 120 seats, down from 123, while Podemos secured 35, down from 42.
With just 155 seats, they are still 21 short for an investiture vote, but are likely to win support from leftwing upstart Mas Pais with its three seats, as well as several other non-separatist regional parties.
The Basque Nationalist Party (PNV), which won seven seats on Sunday and has a long history of propping up minority governments, will "study" the agreement, party spokesman Aitor Esteban said.
"We will be responsible, we will try to be constructive," he added.
But most important would be the backing of centre-right Ciudadanos, analysts said.
Although the party had previously ruled out any support for Sanchez, it suffered a major rout on Sunday, prompting the resignation of leader Albert Rivera.
"Given the collapse in support for Ciudadanos, whose share of seats fell dramatically from 57 to 10, we believe the party wants to avoid another election and being seen as blocking the formation of a government," the Economist Intelligence Unit (EIU) said.
However, the party would have to actively support the government, rather than abstain, given the likelihood that Catalan pro-independence parties would vote against a Socialist-led government. But the announcement drew swift criticism from Ciudadanos, which seemed to immediately rule out backing a Socialist-Podemos alliance.