Alphabet Inc. (GOOGL - Get Report) shares hit a record high Tuesday after the Google parent posted much stronger-than-expected second quarter earnings late yesterday as search revenues improved and one of its key input costs fell for the first time in three years.

Alphabet posted net income of $3.195 billion for the three months ending in June, a figure that fell from the $3.52 billion recorded in the second quarter of last year thanks to the $5 billion fine levied last week by the European Commission for allegedly violating anti-trust rules linked to contracts with Android phone manufacturers. However, once the fine was stripped away, analysts focused on the $10.58 earnings per share figure for the Mountain View, Ca.-based group, which topped Street forecasts, and the better-than-expected $32.66 billion in revenue the group raked in, mostly from its dominant advertising business, which CEO Sundar Pichai said was "firing on all cylinders."

"We're pleased with the ongoing momentum in our advertising businesses," CFO Ruth Porat told investors on a conference call late Monday. "As discussed previously, we continue to identify new opportunities through innovation, including the benefits of applying machine learning to create more useful experiences for users and advertisers."

"Looking ahead, our hardware business is seasonal, typically experiencing lower growth in the third quarter in anticipation of the launch of new products for the holiday season," she added.

I think you will like being a member of the club: https://t.co/2Cj9QmVLog -we have a good note out right now about key holding l$GOOGL https://t.co/VKUnPOivBK

— Jim Cramer (@jimcramer) July 23, 2018

Google shares were marked 4.86% higher from their Monday close in early New York trading and changing hands at $1,269.85 each, a move that extends the stock's year-to-date gain past 20% and values the group at just under $880 billion, making it the world's second most valuable company behind Apple Inc. (AAPL - Get Report) and just ahead of Amazon Inc. (AMZN - Get Report)

Alphabet said its traffic acquisition costs, a key metric of the price is must pay to attract users -- and advertisers --  to its platforms, fell for the first time in three years to 71% of ad partners profits, down from 72% over the same three month period last year. 

Paid ad clicks on Google's own sites and apps rose an impressive 58% year over year, nearly on par with Q1's 59% growth, with mobile search and YouTube the main drivers here. This increase more than offset a 22% drop in cost per click (average ad price) for Google. YouTube, along with a mix shift from PC to mobile search ads, have been the main culprits.

"Within cost of revenues, the biggest component is TAC. As we've discussed for the past couple of quarters, we expected the pace of year-on-year growth in sites TAC as a percentage of sites revenue would slow after the first quarter of 2018, and you can see that clearly in our results of this quarter," Porat explained. "As frequently discussed, we do expect the sites TAC rate to continue to increase year-on-year, reflecting ongoing strength in mobile search, albeit at a more moderate pace relative to the year-on-year increases experienced over the past several quarters."

Around 86% of Alphabet's total revenues came from ad sales on Google, according to the earnings release, although profit margins fell to 24% from 26% last year owing to the fact that more users are getting ads through mobile devices, whose manufacturers charge Google for the traffic.