Investors largely expected digital advertising to take a huge hit in the second quarter, dragging on digital advertising companies like Facebook (NASDAQ:FB). After all, many businesses suffered store closures and limited operations during the quarter, leading to reduced ad budgets. Even more, some businesses were likely impacted so badly that they paused their ad spending entirely.

But Facebook's slowdown in ad revenue growth wasn't nearly as bad as expected -- and that's at the crux of investors' positive response to the social network's earnings report this week. Shares are soaring on Friday, rising about 8% as of 10:45 a.m. EDT as the market applauds Facebook's double-digit ad revenue growth during a period in which many businesses suffered from lockdowns.

Here's a closer look at the results.

Facebook CEO Mark Zuckerberg discusses the company's 10-year roadmap at F8 2018

Facebook CEO Mark Zuckerberg. Image source: Facebook.

Beating expectations

Facebook's total revenue rose 11% year over year to $18.7 billion. This was primarily driven by a 10% jump in advertising revenue, which accounts for 98% of the company's revenue. Helping the company's bottom line, Facebook's operating margin expanded from 27% in the year-ago quarter to 32%. This led to net income and earnings per share of $5.2 billion and $1.80, respectively. These results compare to net income and earnings per share of $2.6 billion and $0.91 in the year-ago period.

Highlighting what a surprise these results were, the consensus analyst estimate was for revenue to grow about 3% and for earnings per share to come in at $1.39.

There's likely more double-digit growth ahead

As social distancing measures continue, there's still uncertainty regarding advertiser budgets. But Facebook indicates that double-digit growth in ad revenue can continue in Q3.

Management said the ad revenue growth rate it experienced in the first three weeks of July was on par with the 10% growth rate it saw in Q2. Therefore, the company expects its "full-quarter Q3 year-over-year ad revenue growth rate to be roughly similar to this July performance," Facebook CFO Dave Wehner said during the company's second-quarter earnings call.

Strong growth despite a boycott

What's particularly notable about Facebook's ad revenue growth during these turbulent times is that it comes amid a boycott in which some major advertisers have paused campaigns on the social network. The boycott, which stems from marketers' disagreement with how Facebook handles some controversial content on its platform, negatively impacted Q2's results. Even more, the tech company's guidance factors in an expected impact from a continued boycott.

Looking ahead, investors will want to see Facebook's ad revenue growth rates accelerate to higher levels. After all, revenue will likely need to grow at a faster rate over the long haul to justify the company's current valuation. But given the resiliency of Facebook's ad revenue amid lockdowns, an economic contraction, and a boycott, it's easy to imagine the social network's ad revenue growth rising to levels in the twenties when the economy returns to some normalcy.