EU finance ministers have agreed a €500bn (£430bn;$540bn) rescue package for European countries hit hard by the coronavirus pandemic.

The chairman of the Eurogroup, Mário Centeno, announced the deal, reached after marathon discussions in Brussels.

It comes as Spain’s prime minister said the country was close to passing the worst of its coronavirus outbreak.

Spain has Europe’s highest number of confirmed cases, with 152,446. More than 15,000 people have died.

The head of the International Monetary Fund (IMF) has warned the world is facing the worst economic crisis since the Great Depression of the 1930s.

Kristalina Georgieva said the coronavirus pandemic would turn economic growth “sharply negative” this year.

At their Brussels talks, EU ministers failed to accept a demand from France and Italy to share out the cost of the crisis by issuing so-called coronabonds.

The package finally agreed is smaller than the European Central Bank (ECB) had urged.

The ECB has said the bloc may need up to €1.5tn (£1.3tn) to tackle the crisis.

However, the French Finance Minister, Bruno Le Maire, hailed the agreement as the most important economic plan in EU history.

“Europe has decided and is ready to meet the gravity of the crisis,” he tweeted after the talks.

The main component of the rescue plan involves the European Stability Mechanism, the EU’s bailout fund, which will make €240bn available to guarantee spending by indebted countries under pressure.

The EU ministers also agreed other measures including €200bn in guarantees from the European Investment Bank and a European Commission project for national short-time working schemes.

Ministers were close to a deal on Wednesday, but the talks broke down and had to be resumed a day later, amid a dispute between Italy and the Netherlands over how to apply the recovery fund.

“Our faith in Europe has proven correct!” tweeted the Italian president of the European Parliament, David Sassoli triumphantly, as soon as EU finance ministers announced the deal.

So is he right: is everything hunky-dory now in the EU? The dark mutterings of deep divisions banished?

Not really.

The EU is stumbling through this crisis as it has done through the migration and the financial crises before, for instance. The bloc is not about to disintegrate but scars will remain in countries that felt the chilly absence of EU solidarity in their hour of coronavirus need.

“This has not been our finest moment,” a diplomat from an influential EU country told me. “Our response has come late and has been marred by nationalism. Solidarity went out the window with the first coronavirus victim.”

The coronavirus pandemic has exposed deep divisions in Europe, where Italy and Spain have accused northern nations – led by Germany and the Netherlands – of not doing enough.

Speaking before the agreement, Italian Prime Minister Giuseppe Conte told the BBC that the EU needs to rise to the challenge of what he calls “the biggest test since the Second World War.”

The infection rate is slowing in Italy. Latest figures show positive cases increasing from the previous day by a little over 1%. Two weeks ago, the rise was 7%. The death rate is also falling.

Spain’s Prime Minister Pedro Sánchez also said the situation there was improving. He told MPs in Madrid on Thursday: “The fire starts to come under control.”

He vowed that the country would have “total victory” over the virus. According to latest data from the past 24 hours, Spain has recorded 683 deaths – a drop from the 757 reported on Wednesday.

Will lockdown be relaxed after Easter?
In recent days, leaders have begun to sound more positive.

Small, non-essential shops are set to open in Austria and Czech Republic next week. Denmark’s schools and kindergartens will reopen on 15 April, and Norway’s on 20 April.

Even Italy is considering when some lockdown measures could gradually be relaxed. Mr Conte said: “If scientists confirm it, we might be able to relax some measures already by the end of this month.”

However Spain extended its state of emergency on Thursday until 26 April, keeping people at home for a further two weeks.

There are also widespread concerns about the Easter weekend, when people usually travel to see loved ones.

Portugal has tightened lockdown measures for Easter, with a ban on people leaving their local area without official documentation.