Three left-of-centre parties in Portugal say they have reached a deal to form a government after last month's inconclusive general election.
It means the centre-right coalition of Prime Minister Pedro Passos Coelho now looks set to fail in its attempt to stay in office.
Socialist Party leader Antonio Costa fought the election promising to ease back on austerity.
He has the support of two smaller far-left parties, including the Communists.
Mr Passos Coelho's centre-right party polled just under 37% in October's election, with the Socialists on over 32%.
He was sworn in for a second term, but earlier this week he said his coalition appeared to have lost its absolute majority in parliament.
With 107 seats in the 230-seat parliament, the ruling coalition was short of the seats it needed.
Mr Passos Coelho had indicated that he was ready to talk to other parties in parliament to pursue the "necessary reforms" he wants to implement.
But the Socialists, the Communists and the Left Bloc between them have 122 seats, enough for a parliamentary majority.
Left Bloc won 10% of the vote, securing 19 seats, while the Communists took 8% of the vote.
"The conditions are in place to bring down the right-wing coalition government and for the Socialist Party to form a government," said the Portuguese Communist Party in a statement late on Friday.
Many in Portugal, including President Aníbal Cavaco Silva, are concerned about the impact on the country's finances and international standing if the far-left gains influence in government, the BBC Alison Roberts in Lisbon reports.
But the president could soon have little choice but to ask the Socialist leader to take over.
A vote on the centre-right administration's programme is due on Tuesday, and if it loses, the government will fall.
"If I am not prime minister as of Tuesday it will be because the Socialists did not let me continue," said Mr Passos Coelho.