Powered by continued mobile momentum and tumbling expenses, social networking giant Facebook (FB) logged second-quarter results on Wednesday that blew away expectations and sent its stock surging 19%.  

The latest quarterly numbers demonstrate that Mark Zuckerberg continues to capitalize on the closely-watched mobile front, which now accounts for 41% of total ad sales, compared with zero just a few quarters ago. 

Facebook said it earned $333 million, or 13 cents a share, last quarter, compared with a loss of $157 million, or 8 cents a share, a year earlier.

Excluding one-time items, it earned 19 cents a share, easily besting the Street’s view of just 14 cents.

Revenue soared 53% to $1.81 billion, exceeding consensus calls from analysts for $1.62 billion.

Excluding stock compensation and related payroll tax expenses, non-GAAP operating margins grew to 44% last quarter, compared with 43% in the second quarter of 2012. Analysts had been bracing for a drop to 37.1%.

Advertising revenue soared by 61% to $1.60 billion, representing 88% of total revenue and beating estimates for $1.39 billion. Mobile ad sales accounted for about 41% of total ad sales. Payments and fees rose 11% to $214 million.

Daily active users during the last month of the quarter averaged 699 million, rising 27% from the year before and topping forecasts for a rise to 695.3 million. Importantly, mobile monthly active users soared 51% to 819 million as of June 30, above estimates of 767 million.

"We've made good progress growing our community, deepening engagement and delivering strong financial results, especially on mobile," Facebook CEO Mark Zuckerberg said in a statement. "The work we've done to make mobile the best Facebook experience is showing good results and provides us with a solid foundation for the future."

Wall Street also cheered as expenses, a source of concern among some analysts, tumbled 35% year-over-year to $1.25 billion. Expenses in the year-earlier period were driven by share-based compensation expenses tied to the company’s initial public offering.

Shares of Menlo Park, Calif.-based Facebook surged 19.12% to $31.63 in extended trading on Wednesday.

Still, in contrast with its hugely hyped IPO in May 2012, Facebook has been a disappointment to investors for much of this year. 

As of Wednesday's close at $26.51, the social network’s stock price was flat in 2012, compared with a 14% jump for the Nasdaq 100, a 27.5% rally for Google (GOOG) and LinkedIn’s (LNKD) 72% surge.

Facebook is also off 30% from its IPO price of $38, although it has surged 51% since tumbling as low as $17.55 in September.

Follow Matt Egan on Twitter @MattMEgan5