The Google partnership will have to pass what is likely to be a rigorous review by US anti-trust regulators and legislators.
The process is non-exclusive, meaning others could join in the bidding to place adverts, a factor that could make it easier for the deal to win regulatory approval.
The companies have agreed to wait three and a half months for such an approval and to offer a way to end it if Yahoo is taken over.
Yahoo intends to use Google's superior search technology to display adverts on its own website as well as those of its partners in the US and Canada.
Eric Schmidt, Google's chief executive, compared the deal to ones in other industries where rivals find ways to co-operate even as they compete.
"The decision of showing ads is a Yahoo decision, not a Google decision," he said.
Yahoo turned to Google to help its chief executive, Jerry Yang, prove he made the right decision last month when he turned down Microsoft's takeover bid of $47.5bn, or $33 per share.
Yang asked for $37 per share, prompting Steve Ballmer, Microsoft's CEO, to withdraw the oral offer.
Icahn's 'coup' bid
Yahoo is trying to fend off a shareholder mutiny led by Carl Icahn, the activist investor, who has vowed to replace the company's board because of the way the directors handled the Microsoft negotiations.
But Icahn has been hoping to engineer a sale to Microsoft, so some shareholders may be reluctant to support his attempted coup unless he can demonstrate his candidates have a better turnaround plan than the current board.
Icahn did not return phone calls seeking comment on Thursday.
The fate of Yahoo's board is scheduled to be determined at the company's August 1 annual meeting.