The International Monetary Fund’s (IMF) board has given its approval for a $3bn (£2.3bn) bailout for Pakistan.
The crisis-hit nation will get about $1.2bn upfront, with the rest due to be paid out over the next nine months.
The South Asian nation was on the brink of defaulting on its debts and had barely enough in foreign currencies to pay for a month of imports.
This week, the country also received funds from allies Saudi Arabia and the United Arab Emirates (UAE).
Pakistan’s Prime Minister Shehbaz Sharif said the bailout was a major step forward in efforts to stabilise the economy.
“It bolsters Pakistan’s economic position to overcome immediate to medium-term economic challenges, giving next government the fiscal space to chart the way forward,” he said.
The IMF deal came after eight months of tough negotiations over how to deal with serious long-term issues with Pakistan’s ailing economy.
The country had been on the brink of being unable to meet debt repayments to creditors.
Much of the country was hit by devastating floods last year, which added to other major problems faced by the country, including high inflation and economic mismanagement by successive governments.
Saudi Arabia deposited $2bn with Pakistan’s central bank on Tuesday, Pakistan’s Finance Minister Ishaq Dar said.
On Wednesday, Mr Dar said the central bank had also received $1bn from the UAE.
The energy-rich Middle Eastern nations had pledged the money in April,but held off handing it over until it was certain that the IMF bailout would be finalised.
The IMF deal, along with the money from Saudi Arabia and the UAE, will unlock more funds to help support Pakistan’s ailing economy.
Pakistan’s foreign exchange reserves are expected to rise to around $15bn by the end of this month, Mr Dar has said.
On Monday, the credit rating agency Fitch upgraded Pakistan’s sovereign rating, with the deal bringing some relief to investors in the country’s stocks and bonds.
The heavily-indebted country’s bonds have soared since the end of June, when the IMF gave preliminary approval for the bailout.
Mr Sharif’s coalition government, which is due to face a national election this year, still has to make major spending cuts to meet the conditions of the bailout.
The cost of living has been soaring in Pakistan. The official annual rate of inflation currently stands at almost 30%.
Last month, the country’s central bank raised its main interest rate to a record high of 22% as it struggled to curb rising prices.
This week’s bailout is the latest in a long line of support Pakistan has received from the IMF. It has taken more than 20 loans from the international lender since 1958.