The 150-year-old Finnish company once dominated the mobile device market, but now isn't among the top five manufacturers.
"We need more combined muscle to truly break through with consumers," said outgoing CEO Stephen Elop. "I share the frustration that comes from being so far behind two very large competitors," but, he argued, "our goal of becoming the third ecosystem is becoming real."
Risto Siilasmaa, chairman of Nokia's board of directors, has been named interim CEO. He said that selling the highest-profile part of the company was difficult but necessary.
"It's evident Nokia doesn't have the resources to fund the required acceleration across mobile phones and smart devices," Siilasmaa said. "Nokia has done great work, however, the industry is becoming a duopoly with the leaders building significant momentum at a scale not seen before."
If it gets regulatory approval, the deal is expected to close in the first quarter of 2014. About 32,000 Nokia employees will transfer to Microsoft.
Elop moved from Microsoft to Nokia to become its CEO three years ago, but Nokia announced he is stepping down to become executive vice president of the devices and services business. It is expected he will carry that title back over to Microsoft once the deal closes.
Microsoft CEO Steve Ballmer, who is expected to retire within a year and could be replaced by Elop, said the deal will help the tech giant "create a family of devices and services."
"Sales of Nokia Windows Phones have gone from zero, two years ago, to 7.4 million units in the most recently reported quarter," Ballmer said. "Now is the time to build on this momentum and accelerate it further."
On news of the deal Tuesday, Nokia shares jumped 40 percent. The Espoo, Finland-based company will now focus the mobile broadband services it sells to 600 carriers in 120 countries, as well as its Here online mapping service.
The deal "will be significantly accretive to earnings, it will clearly strengthen our financial performance and it will provide a solid basis for future investments in Nokia's existing businesses," Siilasmaa said.