Shares in AMD rose 4.6% to $16.50 in late electronic trading after closing up 2.1% at $15.78 on the New York Stock Exchange.
The net loss of $600 million, or $1.09 per share, for the second quarter, compared with a profit of $88.9 million, or 18 cents a year, in the year-ago period.
Falling prices for computer chips was the main culprit behind the loss, but AMD also booked $78 million in charges related to its $5.6 billion purchase of graphics chip maker ATI last year.
Excluding those special items, AMD lost 92 cents per share, more than the 80 cents per share that was the average analyst forecast, according to Reuters Estimates.
Revenue increased to $1.38 billion from $1.22 billion, and topped the $1.25 billion expected by Wall Street.
"We made progress on the top line in the second quarter but clearly we are not happy with bottom-line performance," Chief Financial Officer Robert Rivet said in a statement.
After gaining market share against Intel in 2005 and most of 2006, AMD went through a dramatic downturn last year as Intel rolled out powerful new processors and slashed prices on old ones.
AMD finished 2006 by accounting for more than 25% of unit shipments for x86 processors that act as the brains for almost all the world's personal computers. By the end of the March, that had slipped to less than 19%, according to market research firm Mercury Research.
More recent unit shipment figures are not yet available, but another research firm, iSuppli, said on Thursday that AMD had managed to eke out a small gain against Intel in the three months to June on a revenue basis.
"The main cause of the market-share reversal of fortune was a decline in Intel's microprocessor average selling prices," iSuppli analyst Matthew Wilkins said.
AMD stock has fallen nearly 23% so far this year, compared with a rise of nearly 25% for Intel.
AMD also said it expected revenue for its third quarter to increase in line with the traditional seasonal uptick for the industry. Analysts had expected revenue to be $1.39 billion in the third quarter.
A new chip known as Barcelona, featuring four processing engines on one piece of silicon, would boost sales after its scheduled debut in August, executives said.
"Certainly it looks like they have stemmed the erosion in revenue that had been haunting them for the last couple of quarters," said Nathan Brookwood, an analyst at Insight 64.
Gross margin in the second quarter was 34%, down from 57% a year earlier, but better than 31% in the first quarter.
Rivet said he expected to improve margins further in the third quarter, but declined to elaborate. He added that AMD was cutting its capital spending plan for 2007 by 10% to $1.8 billion.
A 38% rise in processor unit shipments in the second quarter was partially offset by lower prices, resulting in a 20% increase in processor revenue to $1.1 billion. Sales of graphics chips were flat sequentially at $195 million.
"Overall we view these results as positive for AMD, with strong unit shipments and higher gross margins," said JoAnne Feeney, managing director at FTN Midwest Securities.