Microsoft loss makes a history
The loss came after it wrote down the value of Aquantive by $6.2bn (£3.94bn; 5bn euros), which failed to bring the profits expected by Microsoft.
That led to a $492m loss in the three months to the end of June, compared with a profit of $5.9bn a year ago.
The company has not made a loss since it joined the stock market in 1986. It took over Aquantive in 2007 but it struggled to compete with rival Google.
Microsoft is doing well in other areas, despite the decline in popularity of its Windows operating system, which dominated the personal computer market for years.
Revenue for the three months to June rose by 4% to $18.06bn.
Windows 8, which will launch in October, will feature a new look that will present applications in a mosaic of tiles.
Importantly, it will also enable the operating system to work on tablet computers, which along with smartphones are the fastest-growing sector of the computing market.
Microsoft is also planning to release its own tablet, the Surface.
Earlier this week, Microsoft previewed its next version of the Office software suite, which is expected to be released next year.