Google’s parent posted strong results in what the company called “a tale of two quarters,” with a head start in advertising earlier this year making up for the crunch of the global pandemic later.

Alphabet Inc.’s results add to indications that Silicon Valley might weather the economic slowdown better than others in the corporate world. One heavy caveat: Alphabet executives said that company performance fell off sharply as the coronavirus crisis accelerated, and cautioned that they couldn’t predict how the coming months would...