Spain's parliament on Tuesday narrowly confirmed Socialist leader Pedro Sanchez as premier for another term, paving the way for the country's first-ever coalition government since its return to democracy in the 1970s. But it was a very tight vote in the 350-seat chamber, with 167 votes in favour and 165 against -- with 18 crucial abstentions by Catalan and Basque separatist lawmakers. Sanchez, who has served in a caretaker role since last year's inconclusive elections, will helm a minority coalition government with the radical leftwing Podemos in the first such power-sharing agreement in Spain since the death in 1975 of dictator Francisco Franco. After the results were announced, the pony-tailed leader of Podemos, Pablo Iglesias, broke down in tears as his lawmakers chanted the party's slogan "Yes we can!" "A period of moderation, progress and hope begins today," Sanchez tweeted after his victory, which came two days after he lost an initial vote of confidence in which he needed an absolute majority of 176. Tuesday's vote only required a simple majority. The investiture vote draws a line under nearly a year of political deadlock in the eurozone's fourth-largest economy following inconclusive elections in April and again in November. Sanchez will be sworn at the royal palace at 1000 GMT on Wednesday in the presence of Spain's King Felipe VI, a palace statement said. But he was not expected to unveil the lineup of his new government until early next week, party sources said, without giving a reason for the delay. - Crucial abstentions - Although Sanchez's Socialists won the November 10 election, they emerged weakened following a ballot which saw the far-right Vox party surge into third place. Sanchez moved quickly to strike a coalition deal with Podemos, which has never governed nationally, with the two parties pledging to raise the minimum wage and hike taxes on high earners and large businesses. They are also planning to repeal elements of the controversial 2012 labour market reforms that made it easier to fire workers -- prompting warnings from business leaders it would hurt job creation. With the two parties holding only 155 seats, 21 seats short of a majority, Sanchez had to seek support of smaller regional groups. And crucially, he needed to secure the abstention of Catalan separatist party ERC, which has 13 lawmakers, and Basque separatist party Bildu, with its five seats. In return for ERC's abstention, Sanchez agreed to open dialogue with Catalonia's separatist regional government on the future of the wealthy northeastern region and to submit the results of the talks to Catalan voters. The political situation there remains in flux following a failed 2017 independence bid that triggered Spain's worst political crisis in decades. - Very ill, but present - Spain's centre-right and the far-right Vox have accused Sanchez of risking national unity through his pact with the Catalan separatists. And conservative Popular Party (PP) leader Pablo Casado warned Sanchez he would struggle to rule. "Surrendering to the worst radicals may make you prime minister but you will not be able to govern," Casado said when the investiture debate began at the weekend. Sanchez's narrow victory was in part secured by the efforts of Podemos lawmaker Aina Vidal, who missed the first vote due to severe cancer-related pain, but turned up on Tuesday, prompting a round of applause from fellow lawmakers. The successful investiture drew praise on Twitter from new European Commission president Ursula von der Leyen and EU chief Charles Michel. - EU congratulations - "My congratulations to @sanchezcastejon (Pedro Sanchez) and the new Spanish government. Spain is a crucial partner and we will work closely together for a strong, united and fair Europe," tweeted von der Leyen. "Sincere congratulations Prime Minister @sanchezcastejon on your re-election. This is good news for the #EU. Let?s build a greener and fairer Europe together," wrote Michel. But analysts warned there could be a long road ahead. ?While Spain has finally been able to form a government, its majority is tiny and the country lacks experience with multi-party coalition governments," said Moody's analyst Kathrin Muehlbronner. "As for any credit impact, the 2020 budget will be the first key indication of the new government?s economic policy direction," she said, while warning any reversal of earlier labour market reforms would pose "a key risk". However, the prospect of Catalan talks would offer a better chance "for a de-escalation of the conflict" although it would take some time. burs-hmw/boc After finally winning an investiture vote, Spain's Pedro Sanchez embraces his coalition partner Pablo Iglesias, head of the radical left Podemos It was a very tight vote with 167 in favour and 165 against and 18 crucial abstentions Invested at last but Socialist Prime Minister Pedro Sanchez knows it won't be an easy ride Composition of the Spanish parliament.