It's hard to determine what's more surprising about Microsoft Corp.'s investment in Facebook Inc. — the appraisal that valued a 3½-year-old Internet hangout at $15 billion or the rare snub of online search leader Google Inc.

The $240 million price Microsoft paid for a 1.6 percent stake in Facebook demonstrates just how badly the world's largest software maker wanted to deepen its relationship with a startup that doesn't even have $200 million in annual revenue.

By sealing the deal Wednesday, Microsoft finally trumped Google after losing previous high-stakes bidding battles involving a stake in AOL and ownership of online video sharing pioneer YouTube and Internet ad service DoubleClick Inc.

"This was a muscle-in from Microsoft," Gartner analyst Allen Weiner said. "It would have been a nice-to-have for Google, but it was certainly not essential."

• Click here for FOXNews.com's Personal Technology Center.

Besides buying a stake in Palo Alto-based Facebook, Microsoft also will sell Internet ads for its Web site outside the United States, broadening a marketing relationship that began last year.

"This is a strong statement of confidence in this partnership and in Facebook," Kevin Johnson, president of Microsoft's platforms and services division, said during a Wednesday conference call with reporters and analysts.

Tim Armstrong, who oversees Google's North American advertising, declined to comment on the Facebook negotiations during a meeting with analysts Wednesday at the company's Mountain View headquarters.

"We have tremendous respect for them," Armstrong said of Facebook.

Microsoft's investment underscores the skyrocketing value of online communities like Facebook — a place where Web surfers look for dates, connect with friends and family, and share photos, videos and music.

In 2005, News Corp. paid $580 million for outright ownership of MySpace.com, the only social network larger than Facebook.

With its investment, Microsoft established Facebook's current market value at $15 billion less than four years after Mark Zuckerberg started the Web site in his Harvard University dorm room.

Already considered a whiz kid, Zuckerberg, 23, now looks even smarter for rebuffing a $1 billion takeover offer from Yahoo Inc. last year. And Facebook now should have more than enough money to pay for its expansion until it is ready to go public.

Zuckerberg has indicated he wants to hold off on an initial public offering for at least two more years. In the meantime, Facebook hopes to become an advertising magnet by substantially increasing its current worldwide audience of nearly 50 million active users who connect with friends on the site through messaging, photo-sharing and other tools it offers.

Although MySpace remains the largest social network, Facebook has been growing much faster in the past year.

Facebook attracted 30.6 million U.S. visitors during September compared with 68.4 million at MySpace. Microsoft's entry in the social networking arena — "Windows Live Spaces" — attracted 9.8 million U.S. visitors, according to comScore Inc.

To support its growth, Facebook is gearing up to more than double its payroll during the next year to about 700 employees. The company currently employs about 300 workers with annual revenue believed to fall between $100 million and $150 million.

Redmond, Wash.-based Microsoft is counting on Facebook's popularity to help it sell more online advertising — an area where it badly lags Google.

During its fiscal year ending in June, Microsoft's online ad revenue rose 21 percent to $1.84 billion. Over the same period, Google's ad revenue soared 64 percent to $13.3 billion.

Johnson believes Facebook could attract as many as 300 million users worldwide within the next few years, giving Microsoft ample opportunity to recoup its investment.

"We are pleased with the economics of this," Johnson said.

Investors seemed happy, too. After rising 35 cents to finish Wednesday's regular session at $31.25, Microsoft shares added another 35 cents in after-hours trading.

Microsoft also appears interested in Facebook's success with "widgets" — the interactive capsules that offer applications available on other Web sites. Outside developers have created about 8,000 widgets since Facebook began soliciting the contributions in May.

Johnson said Microsoft plans to work with Facebook in areas besides advertising but declined to elaborate.

Facebook may have chosen to hook its wagon to Microsoft because Google has made no secret about its interest in building its own social network.

"Facebook had to look at (Google) twice and say, 'Do we want to take money from someone we may end up competing with?'" Weiner said.

Google's current social network, called Orkut, has seen relatively little success outside South America.

Owen Van Natta, Facebook's chief revenue officer, said the company talked to several suitors before settling on Microsoft. He declined to provide details.

Microsoft's successful courtship of Facebook shows the 32-year-old company is becoming more savvy about the Internet, said Matt Rosoff, an analyst for the research group Directions on Microsoft.

"I think they understand it now and they're proceeding correctly," Rosoff said. "Two years ago, I would have said they don't get it at all."

FOXNews.com is owned and operated by News Corporation, which also owns and operates MySpace.com.