Starbucks (SBUX) saw its fiscal third-quarter revenue plunge by 38% year-over-year, as the coffee giant was unable to avoid the devastating impact of the COVID-19 pandemic, and the ensuing lockdowns that kept customers out of stores.

The coffee giant posted a quarterly loss, but beat consensus estimates as it saw “steadily recovering” traffic and sales. However, the stock surged by over 3% after hours, as the results were better than what Wall Street expected.  

Here were the key figures versus the expectations for the second quarter, according to analysts polled by Bloomberg.

For the fiscal quarter ended June 28, the closely-followed comparable store sales dived 40% globally, compared to forecasts for a decline of 42.8%, according to Bloomberg estimates. In the U.S., same-store sales dropped 40%, while international sales were down 37%. In China, comparable store sales were down 19%.

In a regulatory filing released in June, Starbucks estimated that COVID-19 related lockdowns would cause revenue to drop between $3 and $3.2 billion during the fiscal third quarter, and “adverse impacts” from the crisis would erode comparable quarterly sales by 40-45%. 

In the earnings release, CEO Kevin Johnson said the “vast majority” of Starbucks more than 32,000 stores have reopened and the business globally is on the mend.

“As we continue to drive the recovery, we are also building resilience for the future by accelerating the transformation of our business in ways that will elevate the customer and partner experience and drive long-term growth,” Johnson said.

“We firmly believe that we are well-positioned to regain the positive business momentum we had before the pandemic began and look forward to reigniting our ‘Growth at Scale’ agenda,” he added.

Back in June, Johnson detailed plans to transform Starbucks’ stores by adding drive-thru and curbside pick-up options, as well as rolling out more Starbucks Pick-up stores — accelerating the coffee giant’s initial transformation timeline of three to five years. 

Elsewhere, during the fiscal third-quarter, 90-day active users on the Starbucks app in the U.S. fell to 16.3 million, down 5% year-over-year. 

Shares of Starbucks were up about 2% in the after-hours session after falling 2.38%, or $1.82, to end at $74.64 on Tuesday. 

Julia La Roche is a Correspondent at Yahoo Finance. Follow her on Twitter