Microsoft Corp. snapped up LinkedIn Corp. for $26.2 billion in the largest acquisition in its history, betting the professional social network can rev up the tech titan’s software offerings despite recent struggles by both companies.

The deal is Chief Executive Satya Nadella’s latest effort to revitalize Microsoft, which was viewed not long ago as left behind by shifts in technology. Mr. Nadella hopes the deal will open new horizons for Microsoft’s Office suite as well as LinkedIn, both of which have saturated their markets,...