(Adds concern over rising costs, comments from CFO and analyst)
July 24 (Reuters) - Alphabet Inc surpassed Wall Street expectations for quarterly revenue and earnings on Monday, but it said costs were rising faster than sales and warned that as more traffic and searches shift to mobile devices the expenses would remain high.
The squeeze on expected future profit appeared to weigh on Alphabet's share price, which fell about 3 percent to $967 after the bell. Shares had closed up in regular trading.
Revenue for Alphabet, the owner of Google and YouTube, rose 21 percent to $26.01 billion in the second quarter ended on June 30, beating analysts' average estimate of $25.65 billion, according to Thomson Reuters I/B/E/S.
The growth in revenue, however, was slower than the 28 percent rise in the cost of revenue, a measure of how much money Alphabet must spend to keep its platforms running before added costs such as research.
The rising cost of revenue, including what Google pays to drive traffic to its search engine, hurt operating margins more than most people had expected, said Doug Kass, president of Seabreeze Partners Management.
"This could be problematic going forward," Kass said.
Alphabet Chief Financial Officer Ruth Porat, asked about margins during a conference call with analysts, said the company was not focused on the metric.
"As we've often said, we're focused on revenue and operating income dollar growth and not on operating margins," she said.
Increasing costs, Porat added, are a result of more money going into high-growth products that she said would create value for shareholders.
Alphabet and social media rival Facebook Inc, which together dominate the online ad market, compete for advertising dollars.
This year, Google is expected to have about $73.75 billion in net digital ad revenue worldwide, a 17.8 percent jump from a year earlier, according to research firm eMarketer.
Alphabet's second-quarter revenue was boosted by robust demand for advertising on mobile and YouTube.
Google's ad revenue, which accounts for a lion's share of its business, rose 18.4 percent to $22.67 billion.
Paid clicks, where an advertiser pays only if a user clicks on ads, rose 52 percent. Analysts on average had expected an increase of 35.2 percent, according to data and analytics firm FactSet.
Paid clicks rose 44 percent in the first quarter.
Revenue from its Google Other unit, which includes Pixel smartphone, Play Store and cloud business, rose 42.3 percent to $3.09 billion.
For the second quarter, Alphabet reported earnings per share of $5.01, beating an average estimate of $4.49. The company's net income fell to $3.52 billion.
The company changed the method it reports earnings in the first quarter, focusing on Generally Accepted Accounting Principles (GAAP) earnings instead of non-GAAP results.
Earnings per share would have been $8.90, the company said, if not for a record $2.7 billion antitrust fine announced last month by the European Union. Alphabet recorded the whole fine as a charge during the second quarter, following a plan it announced last month as it weighed an appeal.
EU antitrust enforcers handed down the fine because they said Google had favored its own shopping service, taking a tough line in the first of three probes of its dominance in searches and smartphone operating systems.
Porat said on Monday the company was still early in its analysis of the EU decision.
(Reporting by David Ingram in San Francisco and Rishika Sadam in Bengaluru; Additional reporting by Noel Randewich in San Francisco; Editing by Sriraj Kalluvila and Bernard Orr)