Alphabet (GOOGL 0.86%) (GOOG 0.80%) had an excellent year in 2021. The company makes most of its revenue from businesses advertising products and services. 

And after pulling back on ad spending at the pandemic onset in 2020, advertisers ramped up spending again in 2021. As a result, Alphabet's stock surged by 65% in 2021. Let's look at Alphabet's prospects and determine if the stock is still a buy for 2022.

A person on their laptop.

Image source: Getty Images.

Alphabet has strong tailwinds at its back

In the nine months ended Sept. 30, 2021, Alphabet reported revenue of $182 billion. That's up 44.4% from the $126 billion in revenue it reported during the same period last year. The year-over-year surge in revenue reflects the return of advertiser demand. Economies reopened from major shutdowns, and businesses needed to get the word out that they were open again.

Indeed, global advertising spending was estimated to increase by 22.5% in 2021 to $763 billion. But that's not the only secular tailwind at Alphabet's back; marketers are shifting more of their spending to digital channels: Digital's share of the total advertising market is estimated to increase to 64.4% in 2021, up from 52.1% in 2019.

Interestingly, marketers have options for where they allocate spending online. Over the years, one of their favorite choices continues to be Google's search engine. In its most recent quarter, ended Sept. 30, 2021, Google's search revenue was $38 billion -- more than half its overall revenue of $65 billion. Google's search is arguably the most dominant in the business, with a global market share of 86.6%.

For businesses, advertising through digital channels improves measurement capability. By spending on a Google search ad campaign, marketers can get precise figures on how many people clicked the ad and how many people were shown the ad. That's in stark contrast to non-digital ad spending. For instance, if a business spends money on billboards in Los Angeles, New York, and Miami, it will have no way to know for sure how many people saw its billboards. 

This advantage in favor of digital advertising is not likely to reverse and could be a tailwind for Alphabet for several years. Already, the shift has helped Alphabet increase revenue by a compounded annual rate of 20% over the last decade. The revenue growth has flowed to the bottom line, boosting earnings per share by a compounded annual rate of 16.1% during the same time.

Should you buy Alphabet stock in 2022? 

Alphabet's stock is not expensive despite rising by 65% in 2021. It's trading at a price-to-earnings (P/E) ratio of 27.7 and a price-to-free-cash-flow ratio of 29.8; both are around their average ranges over the last 10 years.

To sum it all up, investors can get a dominant business, growing revenue at 20%, addressing a $763 billion market, generating healthy profits at a relatively inexpensive price. So, yes, Alphabet is a stock to buy for 2022.