Image caption Negotiations continued throughout Sunday night to save SAS from bankruptcy

The troubled Scandinavian airline SAS has said it has reached a deal with trade unions needed to avoid bankruptcy, following all-night talks.

Owners and creditors of the airline have a plan to cut costs and jobs, but it needed approval from eight trade unions representing pilots and cabin crew in Sweden, Denmark and Norway.

The airline said on Monday afternoon it had reached agreement with the one remaining union that had held out.

SAS wants to cut 6,000 jobs.

Agreement with seven of the unions had been reached by early morning on Monday, with the Danish cabin crew union the only remaining obstacle.

"I am very happy that we managed to get a deal," said Helge Thuesen, the union's chairman. "We have stretched ourselves very, very far to reach out to SAS."

SAS said that the Danish pilots' union still needed to obtain approval from one-third of its members, which will be "finalised in the next few days" according to the airline's statement.

Shares in the company jumped by almost a quarter in Monday trading. Even so, they are still down by 98% since their peak in 2007.

Cashflow concerns

"We have successfully negotiated seven of eight collective agreements, which is gratifying," said chief executive Rickard Gustafson.

"But there remains one union and we must have it on board too. That is a condition for carrying out our plan."

An agreement with all eight unions is a precondition for SAS to receive a 3.5bn-Swedish krona ($518m, £325m) loan from its three government parents and from seven current lenders.

Despite the encouraging turn of events, rating agency Standard & Poor's said on Monday that it had cut SAS's credit rating from B- to CCC+, and placed it on review for further downgrade.

S&P attributed its downgrade decision to the company's weak cashflow position, noting it had debts coming up for repayment over the next 12 months, and risked a loss of confidence by its suppliers.

The rating agency made no reference to the union negotiations, but said it would make a decision about a possible further downgrade in the next three months, once it becomes clear whether SAS's restructuring plan is successful, including the possible knock-on impact on ticket sales.

SAS has struggled to deal with stiff competition from rival discount airlines, despite several attempts to cut its own costs.

It has been a very gruelling process Espen Pettersen, Deputy head of the main Norwegian cabin union

The airline, in which the governments of Sweden, Denmark and Norway control key stakes, had set Sunday as a deadline for an agreement with trade unions on wage cuts, as well as changes to pensions and working hours for staff, but talks were extended into Monday.

'Not very happy'

In the early hours of Monday, at Copenhagen's main airport, negotiators were seen entering and leaving the company's headquarters, taking a break for food and drink.

"It has been a very gruelling process," said Espen Pettersen, deputy head of the main Norwegian cabin union.

"We have made big concessions in this agreement. We are not very happy, but we felt we had no other choice but to sign to secure the jobs and the company."

According to Norwegian press, pilots have agreed to a pay cut equivalent to one month's salary, as well as an 8% increase in their workload.

The company's turnaround plan - dubbed "4 Excellence Next Generation" - aims to reduce costs by 3bn krona per year, and sell 3bn krona of assets.

Fears have been widely expressed in the Scandinavian media that a lack of a deal might prompt the airline to apply for immediate bankruptcy.

SAS has told crews to ensure planes are fully fuelled, so that they are able to return home if necessary.

The carrier has also given cash to staff to ensure they can get access to hotels in the case of a bankruptcy.

SAS has said that it wants to cut staff numbers from 15,000 to 9,000, as well as cut salaries by up to 17%.