Google parent Alphabet Inc. said quarterly profit soared 24%, the second internet giant in two days to report blockbuster earnings driven by consumers’ rapid shift to mobile devices.

Alphabet said growth continued as companies bought more ads on its search engine and other products, while users increasingly clicked on those ads. Revenue, fueled by Google’s advertising business, rose 21% to $21.5 billion in the second quarter from a year ago, beating analysts’ average estimate of $20.76 billion.

...