Two years after hitching its fate to Microsoft's Windows Phone software, Nokia collapsed into the arms of the software giant, agreeing to sell its main handset business for 5.44 billion euros ($7.2 billion).
Nokia, which will continue as a maker of networking equipment and holder of patents, was once the world's dominant handset manufacturer but was long since overtaken by Apple and Samsung in the highly competitive market for more powerful smartphones.
Nokia CEO Stephen Elop, who was hired away from Microsoft by the Finnish company in 2010, will rejoin Microsoft after the deal is completed, the companies said.
Nokia and Microsoft have been trying to make inroads in the smartphone market as part of a partnership forged in 2011. Under the alliance, Nokia's Lumia smartphones have run on Microsoft's Windows software, but those devices haven't emerged as a popular alternative to the iPhone or an array of Android-powered devices spearheaded by Samsung Electronics' smartphones and tablets.
Microsoft is betting it will have a better chance of narrowing the gap if it seizes complete control over how the mobile devices work with its Windows software.
In a joint news release from the two companies, Microsoft CEO Steve Ballmer said the deal will bring Nokia's capabilities in hardware design, engineering, manufacturing, sales, marketing and distribution to Microsoft.
"For Microsoft, this transaction is the key next step in furthering the company's transition to a devices and services company," the statement said.
Nokia is still the world's No. 2 mobile phone maker behind Samsung, but it is not in the top five in the more lucrative and faster-growing smartphone market.
Nokia, which had a 40 percent share of the handset market in 2007, now has a mere 15 percent market share, with an even smaller 3 percent share in smartphones, Reuters reported.
When the deal closes, expected to be in early 2014, about 32,000 Nokia employees will transfer to Microsoft. Nokia Chairman Risto Siilasmaa will take over CEO duties while the Espoo, Finland-based company looks for a new CEO.
Ballmer surprised the technology world Aug. 23 by announcing he would step down as CEO of Redmond, Wash.-based Microsoft within 12 months, ending a tenure marked by the software giant's declining dominance and struggles to keep pace with its competitors.
Microsoft said then that Ballmer would retire "upon the completion of a process to choose his successor. In the meantime, Ballmer will continue as CEO and will lead Microsoft through the next steps of its transformation to a devices and services company."
The announcement further stoked speculation in the technology press that Elop might be the one to replace Ballmer. Oddsmaker Ladbrokes had set the odds at 2-to-1 that he would be chosen -- even before news of the deal, the International Business Times reported.
Named in 1871 after the Nokianvirta river where mining engineer Fredrik Idestam set up his second paper mill, Nokia spent more than a century making tyres, boots or cables before producing the first handheld mobile phone, the Mobira Cityman, in 1987.
CNBC, The Associated Press and Reuters contributed to this report.