(Reuters) — Google parent Alphabet’s quarterly sales fell for the first time in its 16 years as a public company, but the decline was less than expected as many advertisers stuck with the most popular online search engine during the pandemic.

Shares of Alphabet fell 1.2% to $1,518.85 after it released the second-quarter results. The stock had rebounded early Thursday to this year’s prepandemic high of about $1,525.

With its mostly free tools for web browsing, video watching, and teleconferencing, Google has become a larger part of many consumers’ lives during the pandemic as lockdown orders force people to rely on the internet for work and entertainment.

But advertisers on Google have suffered mass layoffs and other cutbacks during the pandemic, and marketing budgets are often the first to get slashed, especially by big clients like travel search engines, airlines, and hotels.

Google’s ads business has long trended with the broader economy, and the U.S. economy contracted at its steepest pace since the Great Depression in the second quarter, the Commerce Department said on Thursday.

Google appeared to weather the slowdown better than before, as the pandemic has made the internet more attractive to advertisers than TV, radio, and other avenues.

“This quarter, we saw the early signs of stabilization as users returned to commercial activity online,” Alphabet CEO Sundar Pichai told analysts on Thursday. “Of course, the economic climate remains fragile.”

Alphabet’s overall second-quarter revenue was $38.3 billion, down 2% from the year-ago period. Analysts tracked by Refinitiv, on average, had estimated a 4% decline to $37.367 billion.

The sales decline was the first since the company went public in 2004 and the worst performance since its 2.9% growth during the Great Recession in 2009.

About 66% of Alphabet’s revenue came from Google search and YouTube ads, 12% from ads sold on partner properties online, 8% from its cloud business, and 14% from its mobile app store and about a dozen other smaller businesses.

The company has adjusted by slowing expense growth. Alphabet’s total costs and expenses rose about 7% from a year ago to $31.9 billion in the second quarter, compared with a 12% jump a quarter ago.

Alphabet’s quarterly profit was $6.96 billion, or $10.13 per share, compared with the analysts’ average estimate of $5.645 billion, or $8.29 per share.

New data privacy laws, including one that went into effect this month in Google’s home state of California, are also depressing ad prices.

Antitrust regulators in countries across the Americas, Europe, and Asia are weighing whether Google has stifled competition on its way to dominating search, mobile software, and other businesses, with some bodies even considering forcing it to divest parts of its ad operations.

About 2,000 employees last month petitioned Google’s emerging cloud business to scuttle deals with some police agencies, citing racial discrimination concerns. Whether a massive hiring spree will win other cloud clients is uncertain.

Investors may be shifting toward less ad-reliant rivals. Entering Thursday, Amazon and Microsoft, which have smaller ad businesses than Google but bigger cloud units, were trading at 145 times and 35 times their respective earnings over the last 12 months. Alphabet shares were at 30 times earnings over the last year.

(Reporting by Paresh Dave in Oakland, California and Munsif Vengattil in Bengaluru. Editing by Shailesh Kuber and Richard Chang.)