Sun Microsystems Inc., snapping back to profitability after its first quarterly loss as a public firm, said it earned $5.2 million, or seven cents a share, in the fiscal first quarter. Sun, a maker of computer workstations, reported sales of $538.5 million for the quarter ended Sept. 29, up 39% from $388.5 million a year earlier. In the 1988 period, the company earned $20.6 million, or 26 cents a share. Sun's results were slightly better than expectations. Earlier this month, the company said it expected to break even for the quarter on sales of $530 million. In a statement, Scott McNealy, Sun's chief executive officer, said the company's performance was hampered by problems tied to the introduction of a major new family of computers in April. One of those new computers, called Sparcstation 1, accounted for nearly half of the 28,000 systems Sun shipped in the quarter, he said. More than two-thirds of the systems shipped, meanwhile, were products introduced in April. But problems in manufacturing, forecasting demand and getting the bugs out of a new management information system made it extremely difficult for Sun to meet demand for its newest computers well into the summer. These problems also resulted in Sun reporting a $20.3 million loss for its fourth quarter ended June 30. Mr. McNealy said the issues that hurt Sun's performance earlier this year are now "largely" behind the firm, and he indicated that Sun's profitability should increase throughout the fiscal year. Sun also reported a record backlog of orders. While this indicates continued strong demand for the company's desk-top computers, Sun faces increasing competition from Digital Equipment Corp. and Hewlett-Packard Co. Recently, analysts have said Sun also is vulnerable to competition from International Business Machines Corp., which plans to introduce a group of workstations early next year, and Next Inc.