Microsoft's plan to establish a strong footing in online advertising suffered a big blow on Thursday as merger talks with Yahoo finally, formally failed and Yahoo said it would let Google sell search ads on its site. Separate statements from Microsoft and Yahoo signaled a real rift between the two after their agonizing on-again, off-again talks, and Yahoo shares fell 10 percent as final hopes of a full or partial acquisition faded. Microsoft shares rose more than 4 percent as investors showed relief that the company would not be paying too high a price for a deal they considered risky -- even though its biggest rivals on the Web aimed to work together. Yahoo said it had agreed to let Google put search ads -- advertisements placed next to search results -- on its site in what it called an $800 million annual revenue opportunity that would boost cash flow by $250 million to $450 million in the first 12 months. “Google has made an enormous gain strategically. This move might well have shut Microsoft out of the online space altogether,” said Sanford Bernstein analyst Jeffrey Lindsay. Google and Yahoo, No. 1 and No. 2 in search, will pit ads against each other in auctions for the ad that pays the most. “Yahoo is being a reseller of Google whenever it makes sense, and that is likely to be a lot of the time, given how much more effective Google Web search ads have proven to be,” Global Crown Capital analyst Martin Pyykkonen said. The process is nonexclusive, meaning others could join in the bidding to place ads, a factor that could make a deal easier to pass regulatory approval.