Countrywide Financial Corp posted a $1.2 billion third-quarter loss on Friday as the housing market slumped, but its shares soared after the largest U.S. mortgage lender projected a return to profit this quarter as it slashes jobs and regains its footing.

Shares of Countrywide rose $2.87, or 22 percent, to $15.94 in pre-market trading. Stock futures also moved higher.

The quarterly net loss totaled $2.85 per share, and was Countrywide's first in 25 years. That compared with a profit of $647.6 million, or $1.03, a year earlier.

Countrywide said the quarter represented an earnings trough. It projected fourth-quarter profit of 25 cents to 75 cents per share, and a profitable 2008, with a 10 percent to 15 percent return on equity. It also said it has negotiated $18 billion of highly reliable new liquidity.

There was so much negative sentiment that a whiff of anything positive would help the stock, said Stuart Plesser, an analyst at Standard & Poor's who has a hold rating on Countrywide, after results were released. It still has to worry about liquidity, though it has improved. A big concern remains how much it may need to set aside for credit losses in the future, and that will depend largely on housing prices.

Analysts on average expected a loss of $1.65 per share, according to Reuters Estimates.

Results reflected unprecedented disruptions in the U.S. mortgage market and the global capital markets, as well as continued weakening in the housing market, Chief Executive Angelo Mozilo said in a statement.

CREDIT LOSSES SOAR

Countrywide took a $1 billion write-down for loans and securities because of capital market disruptions.

It also set aside $934.3 million for credit losses, up 2,359 percent from $38 million a year earlier, as more homeowners fell behind on payments.

Results also included a $57 million restructuring charge related to an expected loss of 10,000 to 12,000 jobs. The company expects $70 million to $90 million of additional charges, mainly in the fourth quarter.

Calabasas, California-based Countrywide joins many other financial companies to report write-downs for subprime and other mortgages, including Citigroup Inc, Merrill Lynch & Co, and Washington Mutual Inc.

To cope with the housing downturn, Countrywide has stopped making many risky loans, and has focused on smaller but less profitable loans that Fannie Mae and Freddie Mac will buy. It has also shifted most lending to its bank unit, allowing it to tap a wider array of funding sources.

Pre-tax losses totaled $1.31 billion in mortgage banking, $407 million in banking and $344 million in capital markets. Insurance operations generated a $150 million profit.

Countrywide shares closed Thursday at $13.07. Through Thursday, they had fallen 69 percent this year. They had also fallen 40 percent since Bank of America Corp on August 22 injected $2 billion to shore up its finances.

SEC PROBE

Mozilo still faces challenges, including growing calls from shareholders to step aside. Members of Congress are suggesting legislation is needed to weed out excesses in the $2.3 trillion U.S. mortgage industry, and give more rights to borrowers whom lenders put into unaffordable mortgages.

Countrywide, for its part, this week offered to refinance or modify $16 billion of adjustable-rate mortgages to help borrowers struggling to make payments as rates reset.

Mozilo has also been under fire for accelerating the sale of his Countrywide shares just as the housing market was preparing to slump, realizing well over $100 million of gains. The U.S. Securities and Exchange Commission is reportedly examining these sales. Mozilo has denied wrongdoing.