Facebook reported earnings and revenue that beat estimates in the second quarter on Wednesday, thanks to its robust mobile ad business.
The social media network said it has 1.5 million active advertisers, up from 1 million last June.
"Strong performance across the board shows personalized marketing at scale is working," said Sheryl Sandberg, COO of Facebook. She added that Instagram is "seeing great results" in advertising but is "still taking it really slow."
The company posted earnings of 42 cents a share, excluding one-time items, on revenue of $2.91 billion, a growth of 61 percent from the same quarter last year. Shares turned higher to hit an all-time high in extended hours trading after an initial decline following the results. (Click here to get the latest quotes for Facebook.)
Analysts had expected the company to report earnings excluding items of 32 cents a share on $2.81 billion in revenue, according to a consensus estimate from Thomson Reuters.
Total daily active users increased 19 percent year-over-year, while mobile daily active users grew by nearly 40 percent year-over-year, totaling more than 650 million on average for June 2014, the company said in a release.
"What's happening here is advertisers are getting a good yield and a good return on investment with mobile ads," said Martin Pyykkonen, senior research analyst at Rosenblatt Securities. "So they're working from the advertisers' side."
Revenue from advertising was $2.68 billion, a 67 percent increase from the same quarter in 2013, the firm said. Mobile advertising, which accounted for 62 percent of advertising revenue for the quarter, grew 30 percent from last year.
"We had a good second quarter," said Mark Zuckerberg, Facebook founder and CEO. "Our community has continued to grow, and we see a lot of opportunity ahead as we connect the rest of the world."
Mark Hawtin of GAM called Facebook's results "exceptional."
"The financials are really strong across the board. For me, what was really important was they had a beat on advertising," he said on CNBC's "." "That's what really was needed to drive the shares higher."
The push into mobile ads has partly nudged Facebook into profitability, unlike fellow social media firms such as Twitter.
Facebook already is the second largest earner of mobile ad dollars, behind Google—it has about 22 percent of the mobile ad market to Google's recently fallen 50 percent. Twitter has slightly more than 2 percent of the same market.
Facebook's acquisitions also suggest a serious commitment to mobile. Months after its high-profile purchase of mobile messaging app firm WhatsApp, Facebook bought a small Finnish firm Pryte, which allows users in underdeveloped parts of the world gain temporary wireless access for apps such as Foursquare and Facebook itself, according to Re/code.
Recent actions signal a move into online retailing as well—the company recently tested a "buy" button feature which allows users to make purchases through ads themselves. Facebook is not taking a percentage of the the sales, but could use the feature to link payment information to user profiles, according to Janney Capital Markets analyst Tony Wible.
—By CNBC.com. CNBC's Ari Levy and Julia Boorstin contributed to this report.