Argentina’s Canal 9 received legal approval Tuesday to restructure 82 million pesos ($27 million) of its debt, paving the way for it to up spending on content and keep its staffers.

Judge Alfredo Kolliker Frers approved the third-ranked broadcaster’s offer to repay creditors 32% of their debt in seven annual installments plus 6% interest, starting after a five-year grace period.

The deal comes four years after Canal 9 entered bankruptcy protection as declining ad revenue and rising costs, caused by the country’s 2001-02 economic crash and 70% currency slump, made it impossible to pay debt.

Canal 9 owes most of the debt to studios including Mexico’s Televisa, Venezuela’s Venevision and Argentina’s BBTV and Cris Morena Group.

Spain’s Telefonica, a big creditor and former owner of Canal 9, did not participate in the deal. The judge ruled that it could not vote on repayment terms due to a conflict in competition — Telefonica owns top broadcaster Telefe. Canal 9 said it would negotiate repayment of its $8.8 million debt with Telefonica separately.

The deal also comes as Canal 9 prepares a heavy slate of fiction to claw back ratings from Telefe and Grupo Clarin’s Artear-Canal 13, which have held the first and second spots, respectively, for more than 15 years.

“Our bet is on the talent of actors and scriptwriters,” said owner Daniel Hadad at a presentation of the fall programming lineup this week. He bought the net from Telefonica and JPMorgan in 2002.

Late last year, Canal 9 signed an accord for 18 hours a week of content from Underground Prods., run by Sebastian Ortega, a former No. 2 at Ideas del Sur, who was behind hits like the comedy “Los Roldan” (The Roldans).

Ortega is prepping “Gladiadores de Pompeya,” a one-hour comedy about wrestling fans, and thirtysomethings-comedy “El tiempo no para” for a March or April bow. Also in the pipeline is a househusband sitcom and prison drama.