Investors once feared that the rise of mobile devices would cripple Google. Instead, smartphones are giving the search giant second life.

Google parent Alphabet Inc. reported a 27% surge in third-quarter profit Thursday, extending a strong streak as users spend more time on smartphones and advertisers spend more dollars to reach them there.

Alphabet—the...