For much of the last nine years, Zillow and Trulia have competed in the online real estate listings market they helped create.

But after a speedy six-week courtship, the two are set to combine forces.

Zillow agreed on Monday to buy Trulia for about $3.5 billion in stock, creating a giant online repository of real estate listings and home values.

Under the terms of the deal, Zillow will pay 0.444 of one of its shares for each share of Trulia. Based on Friday’s closing prices, the takeover bid is worth $70.53 a Trulia share, a premium of roughly 25 percent.

Together, the two will dominate the traffic for online home listings. Last month, Zillow reported 83 million users, while Trulia reported 54 million — a combined 61 percent of total Internet users for the category, according to the research firm comScore.

“The companies know each other very well,” Spencer Rascoff, Zillow’s chief executive, said in a telephone interview. “We’ve been competitors and rivals for nine years, but I’ve always had respect for them.”

Zillow has already become one of the best-known players in the market through its widely quoted “Zestimates” of how much a property is worth, a feature particularly popular among homeowners. Trulia, on the other hand, has tools that tend to draw more potential sellers and buyers.

According to Mr. Rascoff, that has meant relatively little overlap, with about half of Trulia’s web users not visiting Zillow.

Mr. Rascoff said he first approached Trulia about a potential acquisition about six weeks ago. The initial response was not dismissive — though Trulia said that it had not intended to put itself up for sale — and management asked what Zillow had in mind.

“Both companies are coming at this from a lot of strength and momentum,” Mr. Rascoff said. “When we approached them, I think they were both very open-minded about it.”

Trulia’s management team, led by Pete Flint, ultimately proved willing to negotiate, but requested that it be an all-stock deal to give Trulia’s shareholders a chance to benefit from the merger. (In the interest of keeping negotiations secret, both sides used code names: Zillow was “Zebra,” while Trulia was “Tiger.” The password to access the electronic data room was “jungle.”)

Existing Trulia shareholders will own about a third of the combined company. Mr. Flint will stay on and report to Mr. Rascoff, and he and another Trulia director will join Zillow’s board.

Together, the two companies expect to realize about $100 million in cost savings by 2016. The newly enlarged Zillow will offer more options for advertisers and for sellers and real estate agents to list home offerings, while combining the two companies’ nascent rental search services.

Mr. Rascoff said he did not expect the merger to face opposition from antitrust regulators. The revenue of the merged company — $341.2 million based on last year’s data — represents only a small part of the $12 billion he estimates the real estate industry spends on marketing each year.

Moreover, he argues, the real estate industry is highly fragmented, with scores of local sites for each city.

Both Zillow and Trulia have sought to combat that by making other acquisitions. In the last year, Zillow bought both the New York-focused StreetEasy and the apartment search site HotPads, while Trulia bought Market Leader last spring for $310 million.

Zillow and Trulia will continue to compete until the deal closes, which is expected to happen sometime next year.

Zillow was advised by Goldman Sachs and the law firms Shearman & Sterling and Perkins Coie. Trulia was advised by JPMorgan Chase and Qatalyst Partners — the investment bank co-founded by Frank Quattrone — as well as the law firms Goodwin Procter and Wilson Sonsini Goodrich & Rosati.

Zillow’s stock closed on Monday at $160.32, up less than 1 percent. Trulia shares closed at $65.04, up 15.4 percent.

This article was originally published in New York Times and can be found HERE.