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.
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.
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 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 Yahoo chief executive Carol 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."
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.
But that tie-up was later abandoned because of the risk of a protracted battle with regulators over competition issues.