It is time to friend Facebook again.

Since reaching a two-year high last August, the stock’s multiple of prospective price to sales contracted significantly throughout the winter and spring amid regulatory threats, lower social-media usage as consumers stepped back out and anticipation of the negative effects of Apple’s recent privacy changes. While it has recovered somewhat in recent months, investors remain uneasy. That presents an attractive opportunity for investors seeking a relative bargain.

After impressive results from fellow social-media companies Twitter and Snap last week, Facebook reported strong second-quarter numbers on Wednesday, growing advertising revenue 56%—edging Wall Street’s expectations moderately. Unfortunately, it had a tough act to follow, reporting just one day after Alphabet, Inc.’s Google said its own second quarter revenue came in a whopping 11% above analysts’ forecast. Facebook’s stock fell 4% in after hours trading immediately following its report.

Investors fear the unknown, but at this point they mostly know the bad news: As more people adopt Apple’s new iOS privacy changes, it is clear that deceleration in ad revenue growth will likely come. On Wednesday, Facebook reiterated its expectations for revenue to slow significantly on a sequential basis in the back half of the year. Analysts expect Facebook to grow ad revenue an average of just 25% year on year over the next two quarters—less than half the growth rate it posted in the second quarter and a slight deceleration from the average growth it showed over the same period last year.

Yet the big second-quarter numbers ad giants like Google and Facebook put up show that companies are willing to spend to acquire customers as the economy reopens—so much so that the dreaded Apple effect might not bite quite as hard as feared. More broadly, solid ad results are illustrative of where the social-media business is heading as it takes center stage in a post-Covid-19 world. In a May note to investors, Morgan Stanley’s Brian Nowak likened online advertising to “the new rent,” noting the pandemic has accelerated retail’s omnichannel shift toward a greater online presence.

Assuming that trend continues, Mr. Nowak sees the potential for at least some of the hundreds of billions of dollars of would-be U.S. retailer rent to be redirected toward online ads. Over time, that should be a boon for Facebook since most of its customers are small businesses that don’t necessarily enjoy widespread brand recognition. With about 2.8 billion people using its platforms daily in June alone, Facebook simply has the most eyes.

Especially given its move after hours, the best thing about Facebook right now is its price. Coming into its earnings report, Facebook was trading at just 8 times forward sales—the cheapest of the major social-media stocks. Snap, by comparison, fetches over 22 times, buoyed by new innovations outside of ads, like video, augmented reality and maps.

But Facebook has hardly been sitting on its hands. It is working to make both virtual reality via “the metaverse” and e-commerce key to its evolution. Because Facebook’s ad business is so big, management has been clear that it will take a while for secondary businesses to become meaningful. Still, commentary from online advertisers this month suggests retail ads are coming back strong, putting Facebook in a good position to better capitalize on them when investors make purchases directly from its apps.

Other companies are even doing some of the work for it: Shopify’s Shop Pay feature, for example, was rolled out to all of its merchants earlier this year. The company says the feature will be available to non-Shopify merchants selling on Facebook’s platforms by the end of the year. Because of its speed, that feature boasts a conversion rate of more than 1.7 times traditional check out, according to Shopify—an outcome that will only bolster Facebook’s apparent value to its advertisers.

The Facebook story isn’t without risk. But if online advertising is indeed rent in a post-pandemic world, you are going to want Facebook as your landlord.

Write to Laura Forman at laura.forman@wsj.com