By Kevin Kelleher, contributor
FORTUNE — 2011 was a good year for Facebook. The social network was adding 100 million users every few months. It was on track for an IPO valued as high as $100 billion — despite a dispirited stock market. And, perhaps most impressively, it had its archrival Google on the run.
Facebook (FB) was hiring Google’s (GOOG) top engineers and threatening to siphon off its ad revenue. Significantly, Facebook was forcing Google to redesign its sites to be more social — that is, more Facebook-like. There is no clearer sign you’re eating your rival’s lunch than the sight of them emulating you.
Of course, 2012 has been far crueller to Facebook. User growth stalled in its home market, and revenue growth disappointed as well. Its IPO was, by one measure, the biggest flop in Wall Street history. And last week, Facebook CEO Mark Zuckerberg indicated that the company might introduce a search engine to drive new revenue.
It’s Silicon Valley’s version of Freaky Friday: the aging web giant with touches of grey and the cocky upstart have reversed roles. The company adding 100 million users to its social network is Google. The company with the sagging market cap is Facebook. (Its $48 billion valuation is a fifth of Google’s.) Both companies have even started to talk like each other. Larry Page describes Google as “a social destination” and Zuckerberg says things like, “Search engines are really evolving towards giving you a set of answers… like, I have a specific question, answer this question for me.”
What gives? One answer is that corporate rivals inevitably bloat their ways into each other’s turf, even to the point of copying each other. For a clear illustration of this, look no further than the patent lawsuits that have become a staple of the smartphone industry. (Plus, as Fortune chronicled in its 2011 cover story, the battle has been a long time coming.)
More importantly, neither search nor social networking is an inherently superior business model. People flocked to social sites like Facebook and Twitter because they were a great way to discover new diversions through their friends and contacts. But it didn’t make search less popular. It just added to the flow of content people get from the web. So it was inevitable that Google and Facebook would move into each other’s core businesses.
In fact, the notion that search was dying and that the future of the web lay in social networks is itself starting to look outdated. Yes, people may spend many more hours on a social network than in a search box, but they also spend much less time bothering to click ads. We go to social networks to find people. We go to search boxes to find answers. So search ads — despite warnings of the demise of search — have continued to do very well.
In light of the rivalry that has emerged between the two companies, Facebook’s plans to push harder into search may appear like an embarrassing capitulation. But just as Page was intent on moving into social to strengthen its overall offerings, Zuckerberg sees search as one more revenue stream to feed into its future growth. And given Facebook’s lackluster stock performance so far, it seems not a bad.
Nor would adding a search engine be the only move that Facebook has copied from traditional web advertising. Several months ago, Facebook Exchange launched, letting ad networks use the browsing histories of users to target display ads next to their Facebook news feeds. Facebook Exchange, which works a lot like Google’s Ad Exchange, showed early signs of improving ad-click rates in its beta program.
Facebook and Google also compete in several other areas, with Facebook Photos taking on Google’s Picasa and Facebook Messaging aping GTalk. And both have made heavy moves into an even more archaic form of web advertising — the hoary old display ad, introduced nearly two decades ago.
According to a recent report from eMarketer, both Facebook and Google will see display-ad revenue grow this year, although Google will grow faster to 15.4% of the display-ad market from 13.5% last year. Facebook will grow to 14.4% of the market from 14.1% last year. By 2014, eMarketer estimates, Google will control 21.2% of the market and Facebook 15.5%.
But efforts like Facebook Exchange and the mobile ad network the company began testing last week could give Facebook a bigger piece of the pie. And now it’s getting serious about search ads as well. Taken together, these initiatives help support the Facebook bulls who say the stock is attractively priced right now. But turning its stock price around will mean moving deeper into Google’s home turf.
So the Google-Facebook rivalry isn’t going away. As Facebook puts its not-so-stellar year behind it — its bruising IPO with it — the most interesting story in the Valley may be this renewed rivalry.