Microsoft is buying the professional networking website LinkedIn for just over $26bn (£18bn) in cash.
The software giant will pay $196 a share – a premium of almost 50%.
Shares in LinkedIn, which floated in May 2011, have fallen by more than 40% this year.
The stock plunged by a quarter in February after the company issued a profit warning for the first quarter and reported an annual loss of $8m.
LinkedIn shares soared to $194.25 in pre-market trading in New York after the deal was announced.
Microsoft said that LinkedIn would retain its “distinct brand, culture and independence”, with Jeff Weiner remaining as chief executive, reporting to Microsoft boss Satya Nadella.
Mr Weiner and Reid Hoffman – the chairman, co-founder and controlling shareholder of LinkedIn – both backed the deal.
“Today is a re-founding moment for LinkedIn,” said Mr Hoffman.
Mr Nadella said: “The LinkedIn team has grown a fantastic business centred on connecting the world’s professionals. Together we can accelerate the growth of LinkedIn, as well as Microsoft Office 365 and Dynamics.”
It is by far the biggest acquisition made by Microsoft, which has completed eight takeovers worth more than $1bn.
It paid $8.5bn for Skype in 2011 and bought Nokia’s mobile phone business for $7.2bn in 2013.
The LinkedIn acquisition also eclipses the $19bn that Facebook paid for WhatsApp in 2014.