A federal judge Thursday blocked Delta Air Lines Inc. from terminating a regional flying contract with a subsidiary of Mesa Air Group Inc.

Mesa shares shot up almost 40 percent on the news.

Phoenix-based Mesa had warned that it would file for bankruptcy protection by July 20 and cut 700 jobs — 14 percent of its work force — if Delta's termination of the contract with Freedom Airlines stuck and Mesa was unable to redeploy unused aircraft.

A spokeswoman for Atlanta-based Delta said the airline was disappointed with U.S. District Judge Clarence Cooper's ruling approving an injunction, and it planned to appeal.

Mesa said the contract amounts to $20 million in monthly revenue for the parent company, or about 20 percent of its total sales for 2007. Mesa has 5,000 employees overall.