Microsoft has become the latest in a spate of US technology giants to have been targeted by hackers.
A statement by Apple on Tuesday said that its computers had been hacked, following a similar attack on Facebook the previous week.
Microsoft blogged that a "small number" of its computers had recently been deliberately infected with malicious software, but there was no evidence that customer data had been compromised.
Microsoft spokesman Matt Thomlinson said in the blog: "This type of cyberattack is no surprise to Microsoft and other companies that must grapple with determined and persistent adversaries."
The websites of The New York Times, The Washington Post, The Wall Street Journal and other newspapers have also been the subject of recent attention from hackers. Earlier this month, President Obama issued an executive order seeking better protection of the United States' critical infrastructure from cyber attacks.