New York CNN Business  — 

Google’s parent company Alphabet posted the first revenue decline in its history during the three months ended in June, a sign of just how much the global pandemic and economic downturn is straining its core advertising business.

The internet giant on Thursday reported nearly $38.3 billion in revenue for the second quarter, down 2% from the year prior. Still, revenue was higher than the $37.4 billion Wall Street analysts had expected.

Alphabet (GOOGL) posted net income just shy of $7 billion, which also beat analysts’ projections. Shares were essentially flat in after-hours trading following the release.

“We continue to navigate through a difficult global economic environment,” Alphabet CFO Ruth Porat said in a statement with the earnings report.

Many companies have pulled back on ad spending as they grapple with the economic crisis brought on by the pandemic.

Advertising revenue across Google’s properties declined 8% during the quarter, to $29.9 billion — dragged down by a nearly 10% drop in Google Search advertising revenue. YouTube ad sales, however, grew nearly 6%.

Ad sales did begin to improve as the quarter wore on, Porat told analysts on an earnings call Thursday.

“We saw a gradual return in user search activity to more commercial topics throughout the quarter, followed by an increase in spending by advertisers,” Porat said on the call. “This resulted in an improvement in year-on-year search revenue trends during the quarter, with search revenues essentially flat to last year by the end of June.”

However, continued surges in coronavirus cases and additional shutdowns across the United States could cause more problems for advertisers. Porat noted that the company may not yet be “out of the woods” when it comes to ad sales.

“As the Covid-19 crisis ravages more parts of the US in the most nefarious and unpredictable of ways, we believe businesses will be less inclined to spend on advertising,” Monness Crespi Hardt analyst Brian White wrote in an investor note last week. “The ad boycott initiatives rippling across the industry are largely focused on Facebook; however, some companies have taken a broader stance on social media platforms and YouTube may feel some pressure.”

Revenue from Google Cloud, a key growth area for the company that competes with Amazon Web Services and Microsoft Azure, grew 43% from a year earlier to more than $3 billion.

The company’s “Other Bets” segment, which includes efforts such as Sidewalk Labs and its self-driving car unit Waymo, once again weighed on profits during the quarter. Other bets posted a $1.1 billion operating loss during the quarter.

The earnings report came a day after CEO Sundar Pichai testified alongside the chief executives of Amazon (AMZN), Apple (AAPL) and Facebook (FB) at a high-profile congressional antitrust hearing.

“We’ve obviously been operating under scrutniy for a while and we realize at our scale, that’s appropriate,” Pichai said on the call Thursday. “From my standpoint, I’m confident in the approach we take, our focus on users, and the evidence in almost all areas we operate in, we expand choice or overall lower prices. … Having said that, we will operate based on the rules, so to the extent that there are any areas where we need to adapt, we will.”