Updated from 9:02 a.m. EDT

A few months ago talk on Wall Street was that printing giant

Xerox

(XRX) - Get Report

, stumbling under a load of high debt, accounting irregularities, slumping sales and credit downgrades, was a bankruptcy risk.

But to the surprise of many, its second quarter beat analysts' estimates as Xerox posted earnings Thursday of $93 million compared with a $101 million loss in the year-earlier period. Revenue fell 7.7% to $3.95 billion from $4.28 billion, but investors still applauded, sending the stock up 16% to $6.66.

And though Xerox still has sizable hurdles to overcome, some analysts believe the worse might be behind it.

Troubled Past

Earlier this year, the Securities and Exchange Commission charged Xerox with using irregular accounting to boost revenues from 1997 to 2000. In June, Xerox agreed to pay a $10 million penalty but did not admit or deny any wrongdoing. It also restated about $1.9 billion of a total of $92.5 billion in revenues that were reported during that period.

Meantime, Xerox has felt the rest of the industry's pain in the form of decreased corporate spending on printing equipment and stiffer competition.

The key feature of the latest earnings report was austerity. Under Anne Mulcahy, who started her Xerox career in 1976 as a field sales representative and became chief executive in August 2001, costs have been cut significantly.

"She's been delivering on her promises," said Dan Schick, a stock analyst at Morningstar, which does not do any underwriting work.

Schick was also impressed that Mulcahy was able to refinance $7 billion while Xerox was under SEC investigation. "A lot of people didn't want to be associated with refinancing Xerox," Schick said, noting that Xerox was hit with slew of credit downgrades earlier this year.

New Initiatives

Xerox also is in the process of getting out of the financial services business. The company had been putting up capital to finance customer purchases, taking away from its cash flow and its ability to pay down its debt.

By the end of this year, a joint venture between Xerox and GE Capital should be complete, allowing GE to act as the third-party financier.

Schick also said Mulcahy has cut costs but not Xerox's research and development budget. "I think their products are more competitive now than they were a few years ago," Schick said.

But until business spending picks up, it will be hard to increase revenues. The company sees revenues continuing to fall in the second half, albeit at a slower rate, and promised that more cost cuts would result in higher-than-expected earnings in the third and fourth quarters.

"They also need to show some improvement in terms of market share and to stem some of their market share losses," Cross said. But, she added, the company has already cut out a lot of costs so discounts would threaten margins.

Xerox reported gross margins of 42.5%, an increase of 3.4 percentage points from last year.

"They're showing fundamental improvements, but they need to work to regain investor confidence," Cross said.