The charge led to a $492 million US loss in the April-June quarter, or six cents a share. That compares with earnings of $5.9 billion, or 69 cents, a year ago.
Revenue rose four per cent to $18.06 billion.
The numbers included a $6.2 billion charge to reflect that Microsoft's 2007 acquisition of online ad service aQuantive, which hasn't yielded the returns envisioned by management.
Excluding the one-time items, earnings came in at 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.
Microsoft's shares were up 48 cents, or 1.6 per cent, at $31.10 in after-hours trading following the release of earnings results.
In the same period last year, the Redmond, Wash., company earned $5.9 billion, or 69 cents per share, on revenue of $17.4 billion.
The acquisition of aQuantive was part of Microsoft’s effort to lure internet advertisers away from one of its biggest rivals, online search leader Google Inc.
But since the deal closed, Google has expanded its share of the online ad market while Microsoft's online division has suffered billions of dollars in losses.
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 out Oct. 26
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.
A revamped version of another lucrative franchise, Microsoft's Office software that bundles word processing, spreadsheet and email programs, is also in the pipeline.
Earlier this week, Microsoft previewed how the next version of Office, expected to be released next year, will work on tablet computers running on Windows 8.
With Windows 8-powered devices still a few months away, some prospective PC buyers have been postponing their purchases so they can buy the latest technology from Microsoft this fall.
That's contributed to a slowdown in PC sales, and revenue in Microsoft's Windows division has dropped in four of the past six quarters.
The pressure won't be on Microsoft until Windows 8 is released on October 26.
Investors will then be closely watching to see if the new operating system delivers on its goal of making Microsoft a significant player in the rapidly growing tablet computer market currently dominated by Apple Inc.'s iPad, while also helping boost PC sales.