FORTUNE -- Paul Adams is one of Silicon Valley's most wanted. He's an intellectually minded product designer with square-framed glasses, a thick Irish accent, and a cult following of passionate techies. As one of Google's lead social researchers, he helped dream up the big idea behind the company's new social network, Google+: those flexible circles that let you group friends easily under monikers like "real friends" or "college buddies." He never got to help bring his concept to consumers, though. In a master talent grab last December, Facebook lured him 10 miles east to Palo Alto to help design social advertisements. On his blog, Adams explained, "Google values technology, not social science."
In the long history of tech rivalries, rarely has there been a battle as competitive as the raging war between the web's wonder twins. They will stop at nothing to win over whip-smart folks like Adams, amass eyeballs, and land ad dollars. There's no public trash talking à la the Oracle (ORCL, Fortune 500) vs. HP (HPQ, Fortune 500) smackdown, nor are the battle lines drawn as clearly as they were when Microsoft (MSFT, Fortune 500) took on Netscape, but the stakes are immense. These companies are fighting to see which of them will determine the future of the web -- and the outcome will affect the way we get information, communicate, and buy and sell.
Facebook and Google: Head-to-Head - Click on the picture for more.
In one corner is Facebook, the reigning champion of the social web, trying to cement its position as the owner of everyone's online identity. In the other is Google (GOOG,Fortune 500), the company that organized the world's information and showed us how to find it, fighting to remain relevant as the Internet of hyperlinks gives way to an Internet of people.
Although Larry Page, Google's co-founder and its CEO since April, was born just 11 years before Mark Zuckerberg, his counterpart at Facebook, the two belong to different Internet generations with different worldviews. In Page's web, everything starts with a search. You search for news or for a pair of shoes or to keep up with your favorite celebrity. If you want to learn about a medical condition or decide which television to buy, you search. In that world, Google's algorithms, honed over more than a decade, respond almost perfectly. But in recent years the web has tilted gradually, and perhaps inexorably, toward Zuckerberg's world. There, rather than search for a news article, you wait for your friends to tell you what to read. They tell you what movies they enjoyed, what brands they like, and where to eat sushi.
Facebook is squarely at the center of this new universe, and much of what people do online these days starts there. But Facebook's masterstroke has been to spread itself across the web and allow others to tap your network of friends. As a result, thousands of websites and apps have essentially become satellites that orbit around Facebook. You can now go to Yelp to find out what your Facebook friends say about the new coffeehouse down the street, visit Spotify to let them pick music playlists for you, or play Zynga games with them. To make matters worse for Page, much of this social activity can't be seen by Google's web-trolling algorithms, so every day they (and by extension, Google) become a little bit less accurate and relevant.
This shift to a more social web changes everything for businesses and consumers alike. Among the first industries to be rocked: advertising. Google may capture 41% of today's $31 billion U.S. online advertising market, including the lion's share of the search-ad market. But growth in search advertising is slowing, and advertisers are putting more of their limited dollars into Facebook, with its 800 million users, many of whom spend more time on Facebook than on any other site. (See chart at the bottom of the page) Facebook's display-ad revenue is expected to grow 81% this year, while Google's display-ad dollars will rise an estimated 34%. Google and Facebook would have you believe there is room for each to drive forward with unlimited success, but don't be fooled. As Stifel Nicolaus analyst Jordan Rohan explains, "It's highly unlikely that either Google or Facebook could grow by the billions that investors expect in the display market without engaging directly and stealing market share from the other."
Like Bill Gates a decade or so earlier, Page is seeing his company's grip on the tech world loosening. So he's fighting back with a mammoth effort to grab a piece of the social web. His first substantial act as Google's new CEO was to amp up the considerable financial and engineering mojo the company had aimed at Facebook's turf by releasing Google+. It's not Google's first social initiative, but it's the one that folks aren't laughing at, and Google says 40 million people have signed up in only four months. Across town Zuckerberg knows Google+ is the first credible threat Facebook has faced since it sailed past MySpace to become the world's No. 1 social network. (For Facebook there are more than bragging rights at stake: Anything that tarnishes its halo could impact its long-awaited initial public offering with a valuation that is expected to top $80 billion.) Not surprisingly, shortly after Google+ made its debut, Zuckerberg flipped on a pink neon sign at headquarters with the word lockdown, signaling that employees were on notice to work around the clock on, among other things, replicating some of the most praised Google+ features.
But defensive moves are not Zuckerberg's style, and in September, at the company's F8 developers event, he unleashed a sea of new features that alter the current service radically. And it's expected the company will launch an ad network eventually that will harness all those social actions to help advertisers target consumers better across the web. Smartly deployed, it could further threaten Google's position as the king of online advertising.
So while most of us spend our days casually toggling back and forth between our Gmail accounts and our Facebook newsfeeds, down in the heart of the San Francisco Peninsula it's war. Zuckerberg served free food this summer to willing workers on the weekends. Page is pushing his team to add features to Google+ at a furious pace: more than 100 in the first 90 days. The decisions that are being made right now -- product launches, advertising plays -- will determine which company prevails.
Larry Page was not pleased. It was a weekend day last spring, and Page, 38, was playing around with an early prototype of Google+ on his Android phone. He found it too cumbersome to post photos he had just taken. He called Vic Gundotra, Google's social czar, to complain. Gundotra tried to push back, explaining why the Google+ team decided on the approach it had taken. Page insisted that photos be uploaded with one click. At Google, what Page asks for, he gets. Gundotra ordered his team to rebuild the photo-uploading feature, and Page now gushes about the technology. "It is a totally magical experience," he said recently, as he described how easy it is to post photos from Android to Google+.
In many ways, Google+ is Larry Page's social network. Early work on Google+ predated Page's ascent to the top post, but he has been intimately involved with the project from the start. In the initial months, Page dropped by every Friday at 11 a.m. for the group's weekly product reviews. To keep close tabs, Page moved his office and much of the executive suite to the building where the Google+ team was sequestered. He blessed the project with massive resources, making it one of the largest engineering endeavors Google has undertaken in its 13-year history, and he elevated Gundotra to the post of senior vice president, reporting directly to him. Page also tied a portion of the bonuses of thousands of Googlers to how well the company did in social.
Google+ is also the first test of Page's plan to transform Google into the nimbler, more accountable company it once was, and in the process avoid the Innovators' Dilemma, the paralysis that grips so many successful companies. In the Google+ project, the company's freewheeling and sometimes chaotic approach to innovation was cast aside -- replaced with a more top-down style. Allowing a thousand flowers to bloom may still be important at Google, says Sergey Brin, the other co-founder, but "once they do bloom, you want to put together a coherent bouquet."
Maybe some discipline is what Google's social ambitions needed. Google's previous attacks on Facebook's turf were an embarrassment. Orkut, Google's first social network, was born alongside Facebook in 2004 but is largely irrelevant outside of Brazil. Open Social, a Google-led effort in 2007 to rally MySpace and other social networks into an alliance to balance the clout of Facebook, flopped. Two years later Google introduced Wave, only to kill it after a few months, and Buzz, a 2010 attempt to shoehorn Gmail users into a social network, quickly turned into Google's biggest social faux pas: Buzz exposed people's Gmail contacts to others, triggering a Federal Trade Commission investigation that forced Google to revamp its privacy policies and accept government monitoring for 20 years.
The Buzz fiasco was a wake-up call at Google. Some of its most high-profile engineers started making the case that the social web posed a vital threat to Google. As the web was being rebuilt around people -- and, in particular, around Facebook's graph of human relationships -- Google could end up on the sidelines, its relevance eroding by the day. The message rattled Google's top brass, and an ambitious project -- called Emerald Sea -- not only to create a credible rival to Facebook but also to transform Google's existing products around social media, quickly took shape. (Gundotra picked the name Emerald Sea to suggest both new horizons and stormy waters.)
After more than a year of gestation, Google finally introduced Google+ in June. The result? A social network that cloned much of what people like about Facebook and eliminated much of what they hate about Facebook. You'll find familiar home and profile pages, tabs for photos and games, and of course the endless updates from friends. Google's +1 button works much like Facebook's Like. But where Facebook is perpetually accused of running roughshod over people's privacy preferences, Google+ made it very easy to decide who can see what users post on the site. Facebook lacked a good way to separate workmates from classmates from real friends, so Google+ was built around Circles, an intuitive way to group people in buckets. Facebook takes 30% of the revenue that app developers like Zynga make on its platform, so Google+ said it would take only 5% for now. Since the launch, Google has rolled out more than 100 new features, and Page says there is much more to come. In Silicon Valley, where everyone had given up on the idea that Google could compete with Facebook, Google+ caught everyone -- including Facebook loyalists -- by surprise. "Google+ was impressive," says Joe Green, one of Zuckerberg's Harvard roommates and the founder of Causes, an application built to run on Facebook.
Until recently, the most popular person on Google+, with 598,000 followers and counting, was Mark Zuckerberg. But he has yet to make a public post, and indeed he'd prefer not to discuss Google+ at all. When pressed at a July event, he called it only a "validation as to how the next five years are going to play out." (Translation: Uh, they're copying us.)
However, inside the Palo Alto office where more than 750 engineers regularly pass by the small glass conference room in which Zuckerberg, 27, holds court, Facebook employees put in some serious overtime during the summer lockdown. This had happened only once before in recent years at Facebook: After word leaked that Google was starting work on a "Facebook killer" in summer 2010, Zuckerberg called on engineers to work nights and weekends for 60 days to revamp key social features like photos, groups, and events. Just as it did then, the cafeteria opened up on evenings and weekends this summer, and children dropped in for dinners and good-night hugs before their parents logged back on for late nights. By September, Facebook had released a slew of new features like better grouping tools to mirror those Google+ circles. Says one member of the product and engineering team: "[Google] can throw all the money in the world, including hundreds of people, at this. So people were, like, This is serious, and we should take it seriously."
That anxiety wasn't simply channeled into building a better product. In May, Facebook secretly hired public relations firm Burson-Marsteller to plant anti-Google stories in papers and blogs, a ham-fisted move that backfired when journalists discovered Facebook was Burson's client. The company defended its concerns about Google's privacy violations but took the flak for bad judgment.
The irony, of course, is that Facebook and Google both are in a constant struggle to respect users' privacy while mining as much personal information as possible for the companies' advertisers. All that social information we plug into Facebook when we "like" a pair of shoes on Zappos or update our status about future wedding plans helps the company serve us up ads for things we're more likely to want. This has made Facebook into the go-to advertising platform for big marketers hoping to do brand advertising at scale on the web. As a result, even though Facebook's revenue is minuscule compared with Google's, it is growing at a much faster rate. It is expected to surge to $4.3 billion this year, or more than double the $2 billion it had last year, according to eMarketer. In contrast, analysts predict that Google's revenue will grow just 30%, to $38 billion.
Zuckerberg is obsessed with figuring out how to amass more data by getting more people to spend more time sharing more things with their Facebook friends. At the F8 event in September, he unveiled something called a timeline to replace Facebook's aging profile pages. "Imagine expressing the story of your life," Zuckerberg explained. To demonstrate, he popped up his own Facebook timeline, where a vertical line scrolled backward through his personal history, curating all the posts he'd ever made on the site to bring to the surface the most important items and encouraging him to add posts and photos going all the way back to the May 14, 1984, post: Born, Dobbs Ferry, New York. In effect, Zuckerberg plans to coax us into making Facebook our living digital scrapbooks. Imagine the hours users may log uploading photos and labeling events from the lost decades B.F. (Before Facebook).
But the boldest move at F8 was not Zuckerberg's flashy redesign but rather deeper social integration with other services like Netflix (NFLX) and Spotify. To register for Spotify, newcomers must now use their Facebook credentials. The upside is that you can find and listen to your friends' playlists on Spotify or on Facebook directly. The downside is your musical tastes are revealed to the world (i.e., Sean Parker is listening to Florence + the Machine). This new stream of social data could prove invaluable over time. Until now, although many web publishers offered users the option to publish their actions -- articles they read, shoes they buy -- on Facebook, most people took a pass. In the new model, sharing becomes opt-out rather than opt-in, and Facebook could become the sudden recipient of a good deal more information about what we do online. Eventually, the company could use the data to sell even more targeted ads both on and off the site. If Google's AdWords and AdSense are the de facto tools for helping advertisers reach large numbers of people who know what they're looking for, social ads will be the tool for helping people discover new things.
One day in late October, tech blogs started buzzing about the latest bit of news on the social web: Zuckerberg had lost his place as the most followed Google+ user. Who edged him out? None other than Larry Page. Trivial, perhaps, but it's hard not to think that the news lit up smiles across the Googleplex. Neither Google nor Facebook likes to talk about competing with each other (and neither company would make their CEOs available for this story), but battles are raging on multiple fronts, and both sides celebrate even the smallest victory.
Nowhere is keeping score easier than in the battle for talent, where every engineer or executive who defects from one company or the other is easily tabulated. On that front the battle has been a lopsided affair. Look through the ranks of Facebook, from upper management to lowly interns, and you'll bump into ex-Googlers like Adams, the social researcher, at every turn. Four of Facebook's 11 top executives hail from Google, including COO Sheryl Sandberg and David Fischer, the advertising and operations chief.
These numbers, however, don't tell the full story of a battle that began as far back as 2007 and has only intensified since. Facebook's weapons of choice? Its cachet as the hottest Valley company -- and its potential to mint millionaires when it finally goes public. Google has fought back with money, lots of it. In some cases Google offered top engineers or execs more than $10 million in equity and cash if they stayed, said an executive directly involved in the talent wars. Word spread quickly, and many Googlers did what rational people would do: They got an offer from Facebook just so they could get a big raise at Google. "It created an un-Googley environment," says a senior manager who left Google recently. "They like to be merit-based." So in January, Google tried a different approach: It lavished a giant 10% raise on its entire workforce. It also shifted a large chunk of employee bonuses into base pay. As a result, many people saw their paychecks increase by 15% or even 20%.
But if Google is playing defense on the talent war, it is clearly playing offense in the battle for eyeballs. Its most powerful weapon is its status as the dominant Internet company. In September, for example, when it opened up Google+ to everyone, following a 90-day trial period, it unleashed the kind of promotion that even the biggest brands would envy: A large blue arrow on its homepage pointed the tens of millions who visit it daily to a Google+ tab. Traffic on the site spiked immediately. In addition to Google.com, Google plans to promote Google+, day in and day out, to the hundreds of millions of people who use services like Gmail, Maps, and YouTube; and to weave it into millions of Android handsets. Says Dick Costolo, the chief executive of Twitter: "There is no doubt they are going to be able to pull in massive numbers of users."
Naturally, it's Google's power to pull in those users that worries Facebook the most. For years executives there have said that they are confident they can beat Google on a level playing field. But they fear that, like Microsoft in an earlier era, Google will use its power to peddle Google+, and not always fairly. Some tactics, like promotions on Google.com, are effective and uncontroversial. Others, like Google's ability to use its search engine to promote Google+ ahead of other social services, could prove more problematic. Google has not yet done so with Google+, but it has done just that with other services, like its maps, prompting rivals to cry foul. Google may think twice before engaging in such tactics, as it is already under a government antitrust investigation. Yet with mobile as the next battleground, Google may also find ways to build many Google+ features right into Android phones and tablets, making it harder for rivals to compete.
That last point is not lost on Zuckerberg. It has prompted him to seek closer ties with Google's biggest rival in mobile: Apple (AAPL, Fortune 500). The two companies have held multiple rounds of discussions, according to people with knowledge of the talks. But they have yet to find a compelling way to collaborate, perhaps because their courtship got off to a rocky start. Last year Facebook rebuffed Apple's attempt to connect Ping, a new social network built around iTunes, with Facebook, purportedly for technical reasons. It was a rare public rebuke for Apple, and Steve Jobs personally called some reporters to voice his displeasure. That Apple chose to bake Twitter, not Facebook, into the most recent version of its mobile operating system has not helped. Still, the two companies continue to talk, knowing full well that an alliance could help them fend off a common enemy.
We know what you're probably thinking: If this is a war, who's going to win? The answer is not straightforward. Google has two goals with social media: One is to slow the momentum of Facebook; the other is to use data from Google+ to improve things like search, maps, and ads. Both Gundotra and Page say the latter goal is the more important one. "We can make search better," Gundotra says. "We can make YouTube and Gmail better. We can make our ads more relevant." He later adds: "Google+ will touch every aspect of Google."
To meet its goals, Google doesn't need to best Facebook, but it needs to become a credible No. 2. Think Avis to Facebook's Hertz. That's a ways off. "At this point, it's more like Thrifty Car Rental," says Danny Sullivan, the editor of Search Engine Land. To get there, Google needs to drink even more of the social Kool-Aid than it has. Consider this: In October a tech blog reported that several top Google officials, including Eric Schmidt, the executive chairman, had not even set up their own accounts on Google+. A few days later Schmidt's account quietly appeared on the site. Google also needs something else: a value proposition that is different from Facebook's and that compels users to switch in large numbers -- or at least to be active on both sites. At this point, it is not clear how many of the 40 million people with Google+ accounts actually use the site. Google won't say. And when asked why anyone should switch to Google+, executives there say again and again that online sharing is broken (tell that to Facebook's 800 million members) and that with Circles, Google+ users can share as they do in the real world (never mind that Facebook has matched that capability).
For Facebook, the early successes of Google+ mean Zuckerberg can no longer afford to screw up. In the past, Facebook's frequent product missteps and privacy snafus were by and large forgiven or forgotten. From now on, Google+ will stand at the ready, more than happy to welcome any disgruntled Facebook users -- not to mention their friends. In other words, as he soldiers on, Zuckerberg must now keep an eye on Page and his troops. Yes, Zuckerberg may feel good about Facebook's gaping lead in users and about having poached dozens of Google's prized brainiacs. But Page has had no problem replenishing Google's ranks. In the most recent quarter, Google added nearly 2,600 employees. That's almost as many people as work at Facebook, and they have a clear mandate: to turn Google into a superpower of the social web.
This article is from the November 21, 2011 issue of Fortune.