NEW YORK/SAN FRANCISCO (Reuters) - Sears Holdings Corp SHLDQ.PK won court approval on Tuesday for $350 million in critical bankruptcy financing that will keep the 125-year-old retailer operating through the holidays while it attempts to reorganize.

FILE PHOTO: The Sears logo is seen outside a store in Brooklyn, New York, U.S., October 10, 2018. REUTERS/Shannon Stapleton/File Photo

Sears reached the deal with Cyrus Capital Partners LP for the financing just before a hearing began in U.S. Bankruptcy Court for the Southern District of New York on the retailer’s so-called debtor-in-possession financing arrangements, according to a person familiar with the matter.

Cyrus' loan replaced a similar deal Sears reached earlier this month with Great American Capital Partners, a financial firm affiliated with liquidation specialist Great American Group and financial services firm B. Riley Financial IncRILY.O. Cyrus offered better terms to Sears, the person said.

“The terms of the transaction were much less favorable than what we had agreed to,” said John Ahn, president at Great American Capital Partners.

A Cyrus spokeswoman had no immediate comment.

A Sears spokesman declined to comment on the deal for the $350 million loan, which U.S. Bankruptcy Judge Robert Drain approved at the hearing.

The loan adds to $300 million that banks provided Sears when it filed for bankruptcy protection in October, giving the beleaguered retailer a total of $650 million in financing.

“These loans are going to benefit everybody,” Drain said.

Hedge funds, including Cyrus, have been in talks with Sears over the past several weeks regarding financing to help it continue operating during bankruptcy proceedings, according to people familiar with the matter.

Sears’ bankruptcy had been expected for years in light of a lengthy slump in sales since the 2008 financial crisis, seven straight years of losses and a debt load of some $5 billion.

In an attempt last year to avoid bankruptcy, Sears sold its Craftsman tool brand to power tool maker Stanley Black & Decker Inc SWK.N for $900 million.

The Hoffman Estates, Illinois-based retailer also signed a deal to sell Kenmore appliances on Amazon.com IncAMZN.O, the e-commerce site whose growing popularity with shoppers has been blamed by several brick-and-mortar retail chains for their hard times and bankruptcies.

Earlier this month, Sears won bankruptcy-court approval to advance plans to stay in business and find a buyer even as it evaluates offers from liquidators.

Some creditors have said Sears should consider winding down by letting liquidators sell its assets in the same way Sports Authority did two years ago and Toys “R” Us did this year when it shut all of its U.S. brick-and-mortar locations.

Sears has already said it intends to close about 180 stores while its chairman, Eddie Lampert, a billionaire who runs hedge fund ESL Investments Inc, works on a potential bid to keep Sears in business.