To remain in office, Mr Sanchez will have to form a governing alliance with smaller parties.
"The Socialists have won the general election", Sanchez declared, smiling broadly as he addressed jubilant supporters at party headquarters in Madrid.
On the splintered right, three parties had competed for leadership: the once-dominant conservative Popular Party, the centre-right Citizens, and the nationalist, anti-migrant Vox party.
Concerns at home and overseas that Vox, a newcomer far-right party, would gain a share of power unprecedented since Spain's return to democracy in the 1970s failed to materialise. Conservative rivals Partido Popular (PP) faced devastating loses, shedding more than half of their seats in parliament.
The left Unidas Podemos alliance that received 42 seats has already expressed readiness to form a coalition with PSOE.
Meghan Markle Reportedly Showing Kate Middleton Support Amid Prince William’s Cheating Rumors
Meghan is reportedly keen to get back to work as soon as possible after the birth of Baby Sussex. Harry is "pleased he can attend today's service, as planned", an insider told People .
Speaking to supporters in Madrid following Sunday's election - which also saw the far-right Vox Party enter Parliament - Spanish Prime Minister Pedro Sánchez said the PSOE's win sends "a message to the world that it's possible to win against regression and authoritarianism".
"My feeling is that in Spain there is an ample progressive majority, and when there is high participation that becomes very clear", Iglesias said. Vox, which formed five years ago, will be the first far-right party with a significant presence in Parliament since Spain transitioned to democracy after the 1976 death of dictator Gen. Francisco Franco. Vox took about 10% of the vote, or 24 seats.
Pablo Casado, who has steered the Popular Party further to the right to stop it from losing votes to the far-right Vox, called the ballot on Sunday the country's "most decisive" in years.
Dolores Palomo, a 48-year-old domestic worker, said she had always voted for the Socialists but cast her ballot for centre-right Ciudadanos this time at a polling station in Hospitalet de Llobregat, near Barcelona, because Sanchez "is a puppet of the separatists".
The Socialists of outgoing Prime Minister Pedro Sanchez were seen leading Spain's election as polls closed on Sunday, according to a survey by GAD3 published shortly after mainland voting ended.
4-1-2-1-2: Man Utd's strongest possible XI vs Chelsea
The £30million signing, 25, is set to end his three-year stay at Old Trafford by moving to the Emirates as Ole Gunnar Solskjaer starts rebuilding United's squad.
They proportionally elect more lawmakers than the inhabitants of big cities, but at the same time the cut-off point for parliamentary representation there is trickier to reach, making the outcome harder to predict the more parties there are.
On Monday, the number two of the Ciudadanos party, Ines Arrimadas, completely shut down the idea of a coalition.
"The chances of (Sanchez) getting a government (with Podemos are) at 90 percent, or better, but the chances of him passing the budget are 40:60", said Javier Diaz-Gimenez, economics professor at business school IESE.
Ciudadanos leader Albert Rivera told supporters on Sunday night his party would lead the parliamentary opposition to Sanchez.
While Sanchez has ruled out any negotiations on Catalan independence, any deal with the separatists would rake over the coals of the most divisive topic of an often tense election campaign that was dominated by issues of national identity. It would be one of only a handful of socialist governments in the European Union.
Apple Reportedly Spends Over $30 Million on Amazon Web Services Every Month
The iPhone maker is said to have recently committed to spending $1.5 billion over a five-year period. Apple's AWS spend dwarfs that of other tech firms such as Lyft and Pinterest.