Portugal has reached a deal with the European Union and the International Monetary Fund on a €78bn three-year bailout, caretaker Prime Minister José Sócrates said.
The country becomes the third eurozone member to require such financial assistance after Greece and Ireland.
The deal will need broad cross-party support because the collapse of Mr Sócrates' government last month means the winner of the general election on 5 June will implement it.
The political turmoil has pushed up borrowing rates and forced the Portuguese to seek a bailout.
Opposition Social Democrat leader Pedro Passos Coelho said he was ready to meet the lenders.
Any of the bailout terms that need parliamentary approval will have to be passed after the election.
'The government has obtained a good deal. This is a deal that defends Portugal,' said Mr Sócrates, who had resisted asking for a bailout for months.
The terms would be less onerous than those set for Greece and Ireland, he added.
He said the deadline for meeting budget deficit goals will be extended, with this year's target raised to 5.9% of gross domestic product from 4.6% previously.
The deficit must be cut to 4.5% of GDP in 2012 and 3% in 2013.
The interest rate on Portugal's bailout loan is expected to be set at a meeting of eurozone finance ministers in the middle of this month.
Portuguese agreement to the loan terms is needed by 15 June, when Lisbon needs to redeem €4.9bn of bonds.
'We have said from the beginning that it is important that any programme should have broad cross-party support and will continue our engagement with the opposition parties to establish that this is the case,' European Commission spokesman Amadeu Altafaj said in a statement.
Officials from the European Commission, the IMF and the European Central Bank have been in Lisbon for almost a month to reach the agreement.
The general election campaign that will now get under way is likely to focus on who is to blame for the country's economic crisis.
However, the final deal remains in doubt because of the continuing opposition of a eurosceptic political party in Finland that is currently in talks to form a new coalition government.
Any financial rescue needs the agreement of all 17 eurozone members.