Yahoo and Microsoft have announced a long-rumoured internet search deal that will help the two companies take on chief rival Google.
Microsoft's Bing search engine will power the Yahoo website and Yahoo will in turn become the advertising sales team for Microsoft's online offering.
Yahoo has been struggling to make profits in recent years.
But last year it rebuffed several takeover bids from Microsoft in an attempt to go it alone.
Yahoo shares closed down 12.1% on the day, while Microsoft shares moved up by 1.4%.
Microsoft boss Steve Ballmer said the 10-year deal would provide Microsoft's Bing search engine with the necessary scale to compete.
"Through this agreement with Yahoo, we will create more innovation in search, better value for advertisers, and real consumer choice in a market currently dominated by a single company," said Mr Ballmer.
"Microsoft and Yahoo know there's so much more that search could be. This agreement gives us the scale and resources to create the future of search," he added.
In return for ceding control of its search engine, Yahoo will get to keep 88% of the revenue from all search ad sales on its site for the first five years of the deal, and have the right to sell adverts on some Microsoft sites.
Yahoo's search team, meanwhile, will have to brace itself for job losses over the next two years. Some staff will transfer to Microsoft, others can stay on with Yahoo, but redundancies would be unavoidable, Yahoo chief executive Carol Bartz told the BBC.
Yahoo said the deal would benefit Yahoo's users and advertisers.
"This agreement comes with boatloads of value for Yahoo, our users, and the industry. And I believe it establishes the foundation for a new era of internet innovation and development," said Ms Bartz.
The deal became possible after Yahoo's co-founder Jerry Yang stepped down as chief executive of the company late last year.
"Only a Yahoo outsider like Ms Bartz could do such a deal," said Tim Weber, business editor of the BBC News website.
"She has no sentimental attachment to what was once the core of Yahoo, its search business. Microsoft was helped by the fact that at long last it managed to develop a search engine - Bing - that is a credible alternative to search giant Google."
Technology analyst Rob Enderle said: "This move makes up for a lot of the stupid mistakes made by the preceding [Yahoo] administration".
Yahoo said the deal would boost annual operating income by $500m and secure $200m in savings.
The tie-up will give Microsoft and Yahoo a combined market share in the US search ad market of about 30%.
Google would still be the dominant force with a share of about 65%.
The deal ends years of back-and-forth negotiations between the two companies.
Microsoft originally offered to buy Yahoo in January 2008 - with an offer worth about $47.5bn.
But Mr Ballmer later withdrew that bid after Yahoo's then boss, Mr Yang, demanded a higher price.
Yahoo instead opted for an online advertising partnership with rival Google.
But that tie-up was later abandoned because of the risk of a protracted battle with regulators over competition issues.