* Sanchez wins by tight margin
* Coalition with Podemos ends months of deadlock
* It aims to change labour, tax laws
* Fragile majority could make it hard to roll out policies 

Socialist leader Pedro Sanchez narrowly won parliamentary backing on Tuesday for Spain's first coalition government in decades, ending a long political stalemate but leaving him reliant on a fragile patchwork of alliances to pass laws.
After nearly a year of caretaker governments, Sanchez won the simple majority he needed by two votes thanks to the support of lawmakers from smaller regional parties.
He and coalition ally Pablo Iglesias, the leader of left-wing Unidas Podemos, now want to roll back some of the labour reforms passed by a previous conservative government and push for tax increases on high-income earners and companies.
But the two parties between them hold just 155 of the 350 seats in a deeply fragmented parliament, where antagonism between left and right was further inflamed by a deal the Socialists struck with Catalan nationalists to get the coalition voted through.
"I trust that we can overcome the atmosphere of irritation and tension and that we can recover a space for consensus and for agreement," Sanchez told parliament prior to the vote.
The session was interrupted by shouts and insults, with politicians from the right accusing Sanchez of betraying Spain over Catalonia, whose independence drive has triggered a political crisis.
In the run-up to the vote, politicians also accused each other of pressuring lawmakers, in particular from small regional parties that said they would back Sanchez, to change their minds.
But in the end, the vote to install Spain's first coalition government since its return to democracy in the late 1970s passed off as expected.
Sanchez won the backing of 167 of the 350 legislators, while 165 voted against.
The remaining 18 abstained, including the lawmakers of Catalan separatist party Esquerra Republicana de Catalunya (ERC), after Sanchez agreed to hold a dialogue over the future of Catalonia and submit its conclusions to voters in the region.
Mainstream right-wing parties have steadfastly refused to hold any such talks on the future of Catalonia, where a botched independence declaration in 2017 led to the jailing of separatist leaders, galvanising an at times violent protest movement.
The rise of new parties in Spain over the past five years has ended decades of dominance by the Socialists and conservative People's Party over Spanish politics, making the process of forming governments and keeping them in power far harder.
The Socialists came first in two inconclusive national elections in 2019, and Sanchez has led a caretaker government that had little margin to push through policies. The minority government he previously headed was forced to throw in the towel after less than a year when Catalan separatists withdrew their support.
Portfolios in his new government have yet to be officially announced but will include Iglesias and Sanchez's economy minister Nadia Calvino as vice-presidents.
How the Socialists and Podemos will work together also remains an open question, as the parties were at odds for much of 2019.
"The hard part starts tomorrow," said Aitor Esteban, a lawmaker and spokesman for the Basque Nationalist Party (PNV), who voted for Sanchez. 
Related Story