Abengoa had been racing to restructure its debt ahead of a March 28 deadline

Spain's renewable energy giant Abengoa said Thursday it had reached a preliminary agreement with its creditors aimed at staving off bankruptcy.

Abengoa had been racing to restructure its debt ahead of a March 28 deadline or face going under, in what would be one of Spain's biggest corporate failures.

The preliminary deal with its main bankers and bondholders foresees the "restructuring of its financial debt and the group's recapitalisation", as well as a 1.5-1.8-billion-euro ($1.7-2.0 billion) injection, the company said in a statement.

It must still be approved by the creditors holding at least three quarters of its debt before the March 28 deadline.

In November the world player in solar and wind power, biofuels and water management announced it was close to bankruptcy following years of unsustainable expansion and filed for protection from creditors.

Abengoa's debt mountain stood at 9.4 billion euros at the end of 2015.