Facebook Inc., in its first earnings report after touching off widespread data-privacy concerns, posted soaring revenue and profit that highlighted the company’s central place in the digital economy.

The social-media giant has weathered one crisis after another in the 17 months since the 2016 presidential election, but its business—at least for now—is still thriving.

Facebook...