The software company had warned that it was taking a $6.2 billion charge because its 2007 purchase of online ad service aQuantive hasn't yielded the returns envisioned by management.
The non-cash adjustment is something companies do when the value of their assets decline. Microsoft Corp paid $6.3 billion for aQuantive, only to see rival Google Inc expand its share of the online ad market.
The charge led to a $492 million loss in the April-June quarter, or 6 cents a share. That compares with earnings of $5.9 billion, or 69 cents, a year ago.
Revenue rose 4 per cent to $18.06 billion.
Excluding the adjustment and the deferral of some revenue into the current quarter related to its launch of Windows 8, earnings came to 73 cents per share, beating the 62 cents per share expected by analysts polled by FactSet.
Although the earnings were higher than expected, analysts were looking for higher revenue at $18.15 billion.
Shares were up 65 cents, or 2.1 per cent, at $31.32 in after-hours trading following the release of earnings results.
Microsoft, which is based in Redmond, Washington, has never previously reported a quarterly loss since the company's initial public offering in March 1986. The aQuantive-driven setback isn't likely to faze investors, who usually focus on what lies ahead for a company instead of dwelling on past mistakes.
Microsoft's fortunes are tied to the October release of Windows 8, the most extreme redesign of the company's flagship operating system since 1995.
Windows 8 will feature a new look that will show applications in a mosaic of tiles and boast new technology that will enable the operating system to work on touch-controlled tablet computers, as well as its traditional stronghold on desktop and laptop computers. In conjunction with Windows 8, Microsoft is planning to release its own tablet, the Surface.