Yahoo has ended talks with Microsoft over a possible investment from the Windows developer, and switched its attention to search giant Google, agreeing a deal to run some of Google's advertisements alongside Yahoo search results.

The nonexclusive deal, announced yesterday, unites Google's and Yahoo's online advertising businesses and comes as a setback to Microsoft, which had been trying to acquire all or part of Yahoo to strengthen its own online business and compete better with Google.

Yahoo said it expects the deal to generate $250m to $450m in operating cash flow during the first 12 months, and that it represents an annual revenue opportunity for Yahoo of $800m. The deal is for an initial period of four years, with an option for Yahoo to extend it for a further six years.

Follow the whole Microsoft Yahoo saga at PC Advisor's dedicated Microsoft News Spotlight

The deal was announced after Yahoo said earlier on Thursday that it had ended its talks with Microsoft over a possible investment by the software giant. Yahoo said it ended the talks because Microsoft was interested only in acquiring Yahoo's search business, not the entire company.

"Clearly it is time to move on," Yahoo CEO and cofounder Jerry Yang said during a conference call. "We believe this agreement with Google helps us to do so by strengthening our competitive position and generating attractive financial benefits."

Yang and Sue Decker, Yahoo's president, said the deal will allow Yahoo to capitalise on growth in the online advertising market and "the convergence of search and display advertising".