Google is still collecting about a third of the $140 billion Internet ad market in 2014, but Facebook's share has doubled over the past two years to nearly eight percent, according research firm eMarketer.
And Facebook, which is able to leverage its huge membership of 1.3 billion people around the world, is not stopping there.
Earlier this month, Facebook unveiled its "Audience Network" that mines what it knows about users to target ads in other applications on smartphones or tablet computers.
Audience Network expands the social network's ad platform beyond its borders on the vast landscape of mobile apps and could provide a major boost to Facebook revenue.
The battle is particularly intense in the fast-growing mobile ad segment: Google's share has dipped slightly over the past two years to 44.6 percent while Facebook has grabbed 20 percent of those revenues worldwide, up from just 5.9 percent in 2012, according to eMarketer.
Tracking users for ads
The world's biggest social network is particularly well-equipped to deliver "targeted" ads that aim to be relevant, based on the browsing history of each users, in part by using the "Facebook login" feature for many websites and services.
(Also see: Facebook introduces Anonymous Login, mobile ad network)
"Because of that Facebook login, they can track people across devices and understand their behavior," said eMarketer's Cathie Boyle.
"Now they're letting advertisers leverage that information beyond just ads on Facebook, which plays to challenging Google."
While privacy activists object to so-called behavioral marketing, this type of advertising is generally seen as effective because it makes more efficient use of ads.
Tech firms are starting to learn this, and find ways to track behavior as users switch from their PCs to tablets or smartphones.
"One of the biggest challenges for advertisers for the rise of mobile is not only technical things, it's really understanding how people use the devices together," Boyle said.
"You have to think about multiple devices. People are not necessarily giving up any of these devices, they are splitting their time between more and more."
Circumventing ad blockers
The login system used by both Facebook and Google have become more important as more people use ad blocking technologies or "private browsing" which prevents marketers from using Web histories.
"Facebook and Google have the same competitive advantage in the landscape, they have the unique login that can be used to identify the user across different devices," said Jennifer Wise at Forrester Research.
"They both have the ability to do it, but Facebook acted on it first. We're expecting Google to make some announcement in the near future of some kind of ad network that is going to do cross-devices targeting."
Google took the first step in that direction in early October, unveiling a tool that allows marketers to determine when an ad delivered on one platform results in a purchase on another.
Amazon rising?
Google and Facebook are not the only companies using these techniques.
Wise said rival firms, such as Twitter and online radio Pandora, also can monitor the activity of its users for marketing. Other such as Apple have the capacity to do so through its login feature.
The online ad market is evolving quickly, and it's not clear yet how new connected devices such as smartwatches or eyewear will impact the ad landscape.
Twitter has seen ad revenues grow at a rapid pace in the past two years, but it still holds less than one percent of the market, behind rivals like Microsoft, Yahoo and AOL.
According to Boyle, it's not clear if any rival can challenge Google on "search advertising," the system which uses keywords for search queries to deliver ads related to those searches.
Because Google is overwhelmingly dominant as a search engine, it logically controls most of the ad search market as well.
But the ad market could face a shakeup from Amazon, which according to The Wall Street Journal is working on its own advertising platform.
Although Amazon's market share is less than one percent, it has the capacity to mount a major challenge. Says Boyle: "Their understanding of shopping behavior is really unique."
For the latest tech news and reviews, follow Gadgets 360 on X, Facebook, WhatsApp, Threads and Google News. For the latest videos on gadgets and tech, subscribe to our YouTube channel. If you want to know everything about top influencers, follow our in-house Who'sThat360 on Instagram and YouTube.