Eurozone finance ministers have agreed a 10bn-euro bailout deal for Cyprus to prevent its banking system collapsing and keep the country in the eurozone.
Laiki (Popular) Bank – the country's second-biggest – will be wound down and deposit-holders with more than 100,000 euros ($130,000; £85,000) will face big losses.
However, all deposits under 100,000 euros will be "fully guaranteed".
Officials warn the island faces a deep recession with many businesses to shut.
The European Central Bank had set a deadline of Monday for the deal, which came a week after the Cypriot parliament rejected a proposed bank levy on small and large deposits.
The new deal will not be put to a vote in the Cyprus parliament.
IMF head Christine Lagarde said the bailout deal agreed was "a comprehensive and credible plan" to help restore trust in the banking system.
Cypriot Finance Minister Michalis Sarris said he believed the possibility of bankruptcy had been averted.
"It's not that we won a battle, but we really have avoided a disastrous exit from the eurozone," he said.
There will be relief in Cyprus that small depositors have been protected, but the deal comes at a heavy price, BBC correspondents say.
The chairman of the Cypriot parliament's finance committee, Nicholas Papadopolous, said the agreement made "no economic sense".
"We are heading for a deep recession, high unemployment. They wanted to send a message that the Cypriot economy ought to be destroyed, and they've succeeded in a large part – they've destroyed our banking sector," he told the BBC.
EU Commissioner for Economic Affairs Olli Rehn conceded that the "depth of the financial crisis in Cyprus means that the near future will be difficult for the country and its people".
Financial markets in Asia and Europe rose in early trading on news of the agreement.
Russian President Vladimir Putin has told his government to look at restructuring a 2.5bn-euro loan extended to Cyprus in 2011.
The BBC's Steve Rosenberg in Moscow says suspicion has been growing in Russia that Europe is using the banking crisis to target Russian money in Cyprus.
The deal came after hours of tense negotiations between Cypriot President Nicos Anastasiades and the "troika" of EU, European Central Bank and IMF leaders.
Under the agreement all deposits of less than 100,000 euros will be secured.
Laiki will be split into "good" and "bad" banks, with its good assets eventually merged into Bank of Cyprus.
The percentage to be levied on large deposits in the Bank of Cyprus – the island's biggest lender – will be resolved in the coming weeks, the president of the Eurogroup of eurozone finance ministers, Jeroen Dijsselbloem, told a press conference overnight in Brussels.
Cyprus government spokesman Christos Stylianides told state radio the level could be set at "around 30%".
Banks in Cyprus have been closed since last Monday while politicians and officials tried to work out how to raise 5.8bn euros to qualify for the bailout. Many businesses are only taking payment in cash.
On Sunday, Bank of Cyprus further limited cash machine withdrawals to 120 euros a day.
With queues growing outside cash machines, Laiki also lowered its daily limit to 100 euros, Cyprus News Agency reported. The bank's previous limit had been 260 euros per day.
The details of the reopening of Cyprus's banks are to be discussed on Monday.
A week ago, the Cypriot parliament rejected a planned bank levy that would have taken 6.75% from small savers and 9.9% from larger investors. The proposal caused widespread anger among ordinary savers.
In response, the European Central Bank (ECB) had said it would cut off funds to Cyprus's banks by Monday unless a new deal was reached.
There is concern on the Mediterranean island that a levy on large-scale foreign investors, many of whom are Russian, will damage its financial sector.
Correspondents say Germany has pushed hard for a levy on investors who have benefited from high interest rates in recent years, rejecting a Cypriot plan to use money from pension funds.
A Cypriot attempt to secure Russian help was unsuccessful.