Total revenue for the quarter ended June 30 was US$4.04 billion, Facebook reported Wednesday, up 39 percent from the same period last year and just over analysts' estimates of $3.99 billion, as polled by Thomson Reuters.
But the company made less money than it did a year earlier, with net income falling by nearly 10 percent to $719 million. Earnings per share declined from $0.30 to $0.25.
Excluding expenses like income tax effects, Facebook reported earnings per share of $0.50, which beat the consensus forecast of $0.47.
In a statement, CEO Mark Zuckerberg called it a strong quarter. But the results also show that Facebook's costs and expenses ballooned by more than 80 percent.
Despite beating analysts' sales and earnings projections, Facebook's stock dropped more than 2 percent after the results were released.
During a conference call with analysts, Chief Financial Officer David Ebersman attributed the cost surge to stock-based compensation and payments related to Facebook's acquisition of WhatsApp. Facebook bought the messaging and calling service last year for a final purchase price of nearly $22 billion.
Even without the WhatsApp expenses, Facebook's costs rose 57 percent, mostly due to new hires and marketing expenses, Ebersman said. Facebook hired more than 870 people during the quarter, most of whom were hired for R&D positions, bringing the company's total headcount to nearly 11,000.
Facebook is branching out from its roots in social networking. Over the past year, the company has pursed ambitious projects in areas such as solar-powered drones and virtual reality headgear. It bought headset maker Oculus VR last year for $2 billion. Facebook is now developing its own virtual reality apps for Oculus.
User growth remained about the same as it's been in the past few quarters. The number of users who logged in monthly grew by 13 percent to 1.49 billion. That's slower than the pace a few years ago.
Mobile users grew faster, gaining 23 percent to 1.31 billion, but that was slower than the previous quarter's rise.
With its user base no longer soaring, the company is looking for new ways to grow its ad sales. Earlier this month, Facebook began a new program to share advertising revenue with a select group of video partners.
Facebook hopes to capture a larger share of advertising budgets typically reserved for TV. It's encouraging both users and advertisers to publish more video to its service, and wants to become a prominent video destination like YouTube.
The company has also gradually begun putting more ads in its photo-sharing app Instagram, which the company acquired in 2012. It hasn't yet broken out advertising revenue for Instagram.
Further out, Zuckerberg has said ads or sponsored messages will also be brought to Facebook-owned WhatsApp and Facebook Messenger.
When Facebook went public in mid-2012, investors initially were concerned about the company's ability to grow its revenue on mobile devices. But that's now where Facebook makes the bulk of its money. As of the second quarter, just over three-quarters of its ad sales came from mobile.
Zach Miners covers social networking, search and general technology news for IDG News Service. Follow Zach on Twitter at @zachminers. Zach's e-mail address is zach_miners@idg.com