"As reported by Facebook and Apple, Microsoft can confirm that we also recently experienced a similar security intrusion," Trustworthy Computing team general manager Matt Thomlinson said in a blog post.
"During our investigation, we found a small number of computers, including some in our Mac business unit, that were infected by malicious software using techniques similar to those documented by other organizations."
There was no evidence customer data was stolen but an investigation into the attack was continuing, according to Thomlinson.
"This type of cyberattack is no surprise to Microsoft and other companies that must grapple with determined and persistent adversaries," he said.
Apple said Tuesday that hackers invaded its system in an attack similar to one recently carried out against Facebook, but that it repelled the intruders before its data was plundered.
The maker of iPhones, iPads, iPods and Macintosh computers said it was working with law enforcement officials to hunt down the hackers, who appeared tied to a series of recent cybe attacks on US technology firms.
"The malware was employed in an attack against Apple and other companies, and was spread through a website for software developers," Apple told AFP.
The malicious software, or malware, took advantage of a vulnerability in a Java program used as a "plug-in" for Web-browsing programs.
A "small number" of computer systems at Apple were infected but they were isolated from the main network, according the Silicon Valley-based company.
"There is no evidence that any data left Apple," Apple said.
Word of hackers hitting Apple came just days after leading social network Facebook said it was "targeted in a sophisticated attack" last month, but that no user data was compromised.
Facebook said malware that infected some of its machines came from a mobile developer website that had been booby-trapped.
Early this month, Twitter said it was hammered by a cyber-attack similar to those that recently hit major Western news outlets, and that the passwords of about 250,000 users were stolen.
While those behind the attacks had yet to be identified, computer security industry specialists have expressed suspicions about China-sponsored hackers and Eastern European crime gangs.