The warning overshadowed the company's beat on Wall Street estimates for quarterly revenue, bolstered by increased advertising spending as businesses build their digital presence to cater to consumers spending more time and money online.

Facebook said it expects Apple's recent update to its iOS operating system to impact its ability to target ads and therefore ad revenue in the third quarter. The iPhone maker's privacy changes make it harder for apps to track users and restrict advertisers from accessing valuable data for targeting ads.

The company also announced on Wednesday that it would require anyone working at its U.S. offices to be vaccinated against COVID-19, joining Alphabet Inc and Netflix.

Monthly active users came in at 2.90 billion, up 7% from the same period last year but missing analyst expectations of 2.92 billion and marking the slowest growth rate in at least three years, according to IBES data from Refinitiv.

"The user growth slowdown is notable and highlights the engagement challenges as the world opens up. But importantly, Facebook is the most exposed to Apple's privacy changes, and it looks like it is starting to have an impact to the outlook beginning in 3Q," said Ygal Arounian, an analyst at Wedbush Securities.

Brian Wieser, GroupM's global president of business intelligence, said all social media companies would see slower growth in the second half of the year and that it would take more concrete warnings about activity in June and July for anyone to anticipate a "meaningful deceleration."

Facebook's total revenue, which primarily consists of ad sales, rose about 56% to $29.08 billion in the second quarter from $18.69 billion a year earlier, beating analysts' estimates, according to IBES data from Refinitiv.

Its revenue from advertising rose 56% to $28.58 billion in the second quarter ended June 30, Facebook said. It pointed to a 47% increase in price per ad.

"In the third and fourth quarters of 2021, we expect year-over-year total revenue growth rates to decelerate significantly on a sequential basis as we lap periods of increasingly strong growth," Chief Financial Officer Dave Wehner said in the earnings release.

Net income in the second quarter more than doubled to $10.4 billion, or $3.61 per share. Analysts had expected a profit of $3.03 per share.

The world's largest social network has been ramping up its ecommerce efforts, which are expected to bring additional revenue to the company and make its ad inventory more valuable. The push will be key to how Facebook, which hosts more than 1 million online "Shops" on its main app and Instagram, can grow its ad business amid the impact of Apple's changes.

It is also on the offensive to attract top social media personalities and their fans, competing with Alphabet's YouTube and short-video app TikTok, which recently hit 3 billion global downloads. Facebook said this month it would invest more than $1 billion to support content creators through the end of 2022.

On a conference call with analysts, CEO Mark Zuckerberg also focused on another ambition for the company: the "metaverse."

Zuckerberg this week announced that Facebook, which has invested heavily in virtual reality and augmented reality, was setting up a team to work on building a shared digital world, which he is betting will be the successor to the mobile internet. Microsoft also dropped the buzzy Silicon Valley term on its earnings call this week, talking about its own plans for the converging digital and physical worlds.

"Facebook has its eye on a sci-fi prize," said Sophie Lund-Yates, equity analyst at Hargreaves Lansdown. "This is little more than an ambition for Facebook at the moment...if the idea comes to fruition, it could be a valuable income source."

The company also continues to face pressure from global lawmakers and regulators, including from the U.S. Federal Trade Commission which has until Aug. 19 to refile its antitrust complaint against the company and from a group of states who said on Wednesday they would appeal the judge's dismissal of their lawsuit. Facebook's market cap hit $1 trillion for the first time last month when the judge threw out the original complaints.

The company, which has long been under fire from lawmakers over misinformation and other abuses on its apps, has also come under renewed scrutiny from President Joe Biden's administration over the handling of false claims about COVID-19. At Facebook's office in Washington, D.C., on Wednesday, a group of critics set up an installation of body bags to protest the issue.

(Reporting by Nivedita Balu in Bengaluru and Elizabeth Culliford in New York; Additional reporting by Danielle Kaye in New York and Sheila Dang in Dallas; Editing by Maju Samuel and Lisa Shumaker)

By Elizabeth Culliford and Nivedita Balu