Adjusted earnings were 42 cents per share, handily beating Wall Street's expectations of 33 cents, according to a poll by Zacks Investment Research.
Facebook's revenue jumped 61 percent to $2.91 billion from $1.81 billion in the same quarter a year ago. Analysts expected $2.8 billion. This was the fifth quarter in a row that Facebook beat Wall Street's forecasts.
Advertising revenue jumped 67 percent to $2.68 billion. Mobile ad revenue, a closely watched figure, was 1.66 billion, or 62 percent of Facebook's total advertising revenue for the quarter. In the first three months of the year, mobile ads accounted for 59 percent of Facebook's total ad revenue.
The steady increase indicates that Facebook is succeeding in steering advertisers to its mobile platform at a time when most of its users are using mobile devices to access the social network.
Facebook had 1.32 billion active users at the end of June, up 14 percent from a year earlier. On average, 829 million people used Facebook every day in June, up 19 percent from a year earlier. The number of people who log in at least once a day on mobile devices was 654 million on average in June, up 14 percent from a year earlier.
"We had a good second quarter," said CEO Mark Zuckerberg in a statement. "Our community has continued to grow, and we see a lot of opportunity ahead as we connect the rest of the world."
Facebook has been growing its share of the worldwide digital advertising market, but it's still a long way from catching up to rival Google Inc. In 2013, Facebook had a nearly 6 percent share of the market compared with Google's 32 percent according to research firm eMarketer. This year, Facebook is expected to grow its slice to nearly 8 percent, while Google's should decline slightly, to just below 32 percent.
Facebook's stock jumped $2.77, or 3.9 percent, to $74.06 in extended trading after the results came out. The stock had closed up $2.02 at $71.29.
Shares of the Menlo Park, California-based company have climbed $16.64, or 30 percent, to $71.29 since the beginning of the year, while the Standard & Poor's 500 index has climbed 7.5 percent. The stock has more than doubled in the last 12 months.