For the three months ended June 30, Sun earned $795 million, or 24 cents per share, compared with a loss of $1.04 billion, or 32 cents per share, in the same period last year. Sales rose 4.3 percent to $3.11 billion from $2.98 billion last year.
The results include $1.6 billion of other income and $350 million in deferred other income related to Sun's April 2 settlement with Microsoft. Sun said it is seeking confirmation from federal regulators of its accounting related to the settlement.
In a statement, the company said a full breakdown of the results are "pending final resolution of these matters."
Analysts were expecting Sun to lose 4 cents per share on sales of $2.89 billion, according to a survey by Thomson First Call. During its third-quarter conference call, the company declined to provide guidance.
"Delivering growth and preliminary profits in Q4 is a great way to end the year," said Scott McNealy, Sun's chief executive. "We enter the new fiscal year with a strong balance sheet, the strongest product and services portfolio in our history, and the largest developer and partner communities we've ever had."
For the year, Sun lost $376 million, or 11 cents per share, on sales of $11.19 billion, compared with a loss of $3.43 billion, or $1.07 per share, on sales of $11.43 billion, in fiscal 2003.
During the 1990s, Sun servers powered by its Sparc microprocessors and Solaris operating system were the systems of choice for cash-rich dot-coms and other booming companies.
But Sun, which had seen its stock soar to $64 per share in 2000, was particularly hard hit when the tech boom ended. Its business also suffered as low-cost hardware and software became more powerful, and it was slow to react to the market shift.
The company also was slow to trim staff and other costs, even as losses mounted and sales plummeted. In recent years, several executives have left the firm, including president Ed Zander and chief scientist Bill Joy.
In April, Microsoft agreed to pay Sun $1.6 billion to settle their long-running legal battles and $350 million in royalties.
Sun's results were released after the close of financial markets. Shares of Sun ended at $4.11, up 17 cents, in Tuesday trading on the Nasdaq Stock Market.