Meta easily beat Wall Street’s expectations for the second quarter, helped by higher advertising revenue and a growing user base on its flagship social media platforms. The money is helping to fund the Menlo Park, Calif.-based company’s massive investments in AI development and hiring top talent at eye-popping compensation levels.

“Not only has Meta made demonstrable strides with AI, but it’s helping to future proof itself as a growth company, should its family of apps get affected by the current anti-trust case or changing social media sentiment,” said Forrester research director Mike Proulx.

The company earned $18.34 billion, or $7.14 per share, in the April-June period. That’s up 36 percent from $13.47 billion, or $5.16 per share, in the same period a year earlier.

Revenue jumped 22 percent to $47.52 billion from $39.07 billion.

Analysts expected Meta to earn $5.88 per share on revenue of $44.81 billion, according to a poll by FactSet.

Meta’s daily active user base on its apps — Facebook, Messenger, WhatsApp, Instagram and Threads — was 3.48 billion, up 6 percent year-over-year.

Meta said it expects costs to increase as it spends billions on infrastructure and luring highly compensated employees as it works on its AI ambitions. It’s forecasting 2025 expenses to be in the range of $114 billion to $118 billion, up 20 percent to 24 percent year-over-year.