The software company, which was launched 26 years ago, had warned two weeks ago that it would take a $6.2bn (£3.9bn) charge in the April to June quarter because its 2007 purchase of online ad service aQuantive had failed to help it compete with Google (NasdaqGS: GOOG - news) .
Including the big write-down on aQuantive, Microsoft posted a $492m (£313m) loss in the fiscal fourth quarter compared with earnings of $5.9bn (£3.75bn) a year ago.
Revenue rose 4% to $18.06bn (£11.5bn).
Microsoft's fortunes are now tied to its October 26 release of Windows 8, the most extreme redesign of the company's flagship operating system since 1995.
Windows 8 will feature a new look and boast new technology that will enable the operating system to work on touch-controlled tablet computers, as well as Microsoft's traditional stronghold of desktop and laptop computers.
In conjunction with Windows 8, Microsoft is planning to release its own tablet , the Surface, to compete with Apple (NasdaqGS: AAPL - news) 's iPad.
AQuantive was Microsoft's most expensive purchase at the time, and was supposed to help it mount a more serious challenge to Google in online ads.
But the online ad division continued to post losses - totaling more than $9bn (£5.7bn) since the purchase, not including the charge.
By contrast, Google's search engine, a major vehicle for selling ads, has remained strong, while Microsoft's Bing search engine saw its market share drop slightly to 26%, from 27% a year ago.
That includes searches through Yahoo (NasdaqGS: YHOO - news) , which has been using Microsoft's search technology for nearly two years.