Now that Facebook has become a mobile company, the money is starting to follow

In January, the number of daily active users on Facebook (s fb) finally accessing the service from mobile devices surpassed those accessing it from the desktop, making it clear that Facebook had truly become a mobile company. As we wrote at the time, succeeding on mobile was no longer an option — it was an inevitability. But up until this quarter, the question of whether ad revenue would follow those users to the phones was a lot less clear, leading to more questions from investors as to whether Facebook could succeed with mobile ads.

But Facebook’s second-quarter numbers on Wednesday, which trounced analyst expectations and sent the stock up 19 percent to $31 in after-hours trading, are the numbers that investors were looking for when it comes to proving Facebook could make money on mobile.

Just a year ago, Facebook had hardly any mobile ad products at all, but in the second quarter earnings presented Wednesday, the company announced that mobile advertising now makes up 41 percent of all ad revenue — easily the greatest percentage since Facebook was founded, and up from the previous high of 30 percent last quarter.

Here’s how the percentage of ads from mobile has grown since just the third quarter of 2012:

Facebook’s COO Sheryl Sandberg, who has spearheaded the growth of ads on Facebook’s platform, talked about the leaps the company has made this year on the earnings call Wednesday:

“Obviously the transition to mobile is a really big one. We had almost no mobile ads a year ago, and we’re up to 41 percent this quarter,” she said. And how exactly did Facebook get there? “We’ve done a lot of work around targeting. The most important work we’ve done over the past year is around custom audiences.”

Sandberg said that as Facebook has drilled down into specific audiences by demographic and interest — as specific as someone who is currently looking to buy a car, for instance — that focus has meant that the company has been able to serve up more ads in the News Feed without losing user interest or attention (even if it’s still unclear how that will hold up once everyone transitions to the new News Feed design.) And being able to serve up more ads without losing user attention is key to making money.

But even more broadly, CEO Mark Zuckerberg said that the financial gains on mobile that are finally appearing this quarter were actually a long time coming, and something the company was seeing internally, even if the financial numbers weren’t showing them just yet. For a long time, the company had pretty terrible mobile ads. Over the past year, it has worked to revamp those, which created the necessary platform for ads to thrive.

“We weren’t happy with the quality of our mobile experiences for 18 months, so we had a lot of foundational work to do,” Zuckerberg said. “We could tell internally that we were turning a corner on that, but I think as the numbers from this quarter suggest, we’re really starting to see the upside of some of the investments we’ve been making over the last period.”

Now that Facebook has set a pretty high bar for the growth we can expect each quarter on mobile ads, the questions will surely just keep coming: When will the company hit 50 percent? When will it hit 75 percent? But if Facebook’s performance in user growth is any indicator, where it’s managed to keep expanding even after hitting a whopping 1 billion, Zuckerberg and Sandberg and their team could be better prepared for increasing demands from investors than we might expect.