Google released its 2015 second-quarter earnings Thursday. Pictured: The company's logo is seen at its Mountain View, California, headquarters. Reuters/Clay McLachlan CM/GN

Google Inc.'s stock surged more than 11 percent in after-hours trading Thursday after the search giant posted second-quarter results that matched analysts' revenue estimates riding on improved performance from its mobile search business.

The company posted earnings of $6.99 per share, ahead of analysts' $6.71 per share estimates. Google also posted $17.7 billion in revenue, up 11 percent year to year, for the quarter, matching analysts estimates. More importantly, Google attributed the feat to improvement in its mobile search advertising business. That's a good sign for investors, who in recent years have seen Google struggle to adjust its business to an increasingly mobile world of digital advertising. Additionally, Google said it saw improvements from its YouTube unit as well as its programmatic advertising business.

“Our strong Q2 results reflect continued growth across the breadth of our products, most notably core search, where mobile stood out, as well as YouTube and programmatic advertising,” said Ruth Porat, chief financial officer of Google, in a statement. “We are focused every day on developing big new opportunities across a wide range of businesses. We will do so with great care regarding resource allocation.”

Google Earnings
Google's positive second quarter results sent shares of the company flying in after-hours trading. Google

In May, Google said mobile search had finally overtaken desktop in terms of search queries processed in the U.S. and nine other countries. This had been expected, but the big question was, could Google monetize this growth the same way it was able to with the desktop search market. Google, which doesn't break out ad revenue by service, appears to be growing its mobile search business at a satisfactory rate for now.

Additionally, investors were also pleased to hear earlier this week that Google is now beginning to be more frugal about its hiring and spending as a way to ensure the company runs in an efficient way.

"Investors should be really encouraged by the growth Google put up this quarter in its core search business, particularly as management noted in mobile," said Jason Moser, an analyst for Motley Fool. "If Google is able to continue growing its top line at such rates, while bringing costs back under control, shareholders could be looking at some banner days ahead."

Despite the promising results, though, Google still has work to do. The company is continuing to see declines in its cost-per-click, which determines how much advertisers pay for each ad they place on Google. Cost-per-click on Google websites was down 16 percent compared to last year while aggregate cost-per-click was down 11 percent year to year.