The S&P 500 has already climbed roughly 19% this year amid soaring investor sentiment, but history says there is more gas in the tank. Since 1928, the index has frequently moved higher in December, more so than in any other month, returning an average of 1.3%.

To be clear, I am not suggesting that investors target short-term returns. Stocks should always be assessed through a long-term lens. But investors who buy good stocks ahead of the holiday season may quickly find themselves in the black, and there is nothing wrong with that.

Advertisers and retailers are among the companies most likely to benefit from holiday enthusiasm, which makes Alphabet (GOOG 9.96%) (GOOGL 10.22%) and Shopify (SHOP 1.11%) timely buys right now.

1. Alphabet

Alphabet is the largest ad tech company in the world. Its market share is expected to drop about 90 basis points this year, but it will still account for nearly 29% of global digital ad revenue, according to eMarketer. That success comes from its profound ability to engage consumers and collect data from across the internet.

Alphabet owns six products that serve over 2 billion users, including the most popular internet search engine (Google Search), the most popular streaming platform by viewing time (YouTube), and the most popular mobile operating system (Android). Those products make Alphabet an invaluable advertising partner for brands, as they afford the company tremendous reach and deep insight into consumer behavior.

In cloud computing, Google Cloud still ranks a distant third to Amazon Web Services and Microsoft Azure, but it has gained four points of market share (bringing the total to 10%) in the last four years. One reason for that success is expertise in artificial intelligence (AI). Google has a strong presence in the markets for cloud AI developer services and AI infrastructure, and consultancy Gartner recently called the company a leader in AI research.

Going forward, CEO Sundar Pichai sees two AI products in particular as potential growth drivers: Vertex AI and Duet AI. The former is a cloud service for training machine-learning models and building AI applications. The latter is a generative AI assistant that uses natural language to automate workflows across Google Workspace applications, such as drafting text in Google Docs and creating images in Google Slides.

Alphabet delivered mixed results in the third quarter. Total revenue increased 11% to $76.7 billion and GAAP net income soared 42% to $19.7 billion. But Google Cloud revenue missed expectations, causing the stock to fall following the report. Investors should monitor the cloud segment closely, but slowing growth is likely a product of economic headwinds, meaning there is no cause for alarm.

Looking ahead, the ad tech and cloud computing markets are expected to grow at roughly 14% annually through 2030 according to Grand View Research. That gives Alphabet a great shot at low-double-digit sales growth for years to come. In that context, its current valuation of 6 times sales appears reasonable, so investors should take the opportunity to buy a few shares today.

2. Shopify

Shopify provides software and services that simplify commerce. Its platform gives businesses a single view of their operations across physical and digital sales channels. That includes popular online marketplaces like Amazon and Etsy, and trendy social media like YouTube and TikTok, as well as mobile applications and direct-to-consumer websites.

Shopify further supports merchants with ancillary solutions for payments, financing, logistics, and more. Additionally, its enterprise-grade platform (Shopify Plus) includes more sophisticated tools for data analytics, workflow automation, machine-learning-powered marketing, and business-to-business (B2B) commerce.

That turnkey approach to retail (and wholesale) has earned Shopify a strong market presence. Consultancy Gartner recently recognized its leadership among digital commerce platforms, citing a greater ability to execute than any other vendor. Similarly, research company G2 has consistently recognized Shopify as a leader in e-commerce software and omnichannel commerce software.

Shopify reported impressive financial results in the third quarter, beating expectations on the top and bottom lines. Revenue increased 25% to $1.7 billion and GAAP net income improved to $718 million, up from a loss of $159 million in the prior year. Additionally, management said its attach rate (revenue as a percentage of gross merchandise volume) increased 9 basis points, meaning merchants are adopting more adjacent services.

Looking ahead, retail e-commerce sales are expected to increase at 8% annually to reach $8 trillion by 2030. Shopify will undoubtedly benefit from that tailwind. But its upmarket push with Shopify Plus represents an incremental growth opportunity. The company has yet to start charging for its machine-learning-powered marketing software, and its B2B commerce tools address a market forecasted to grow at 36% annually to reach $36 trillion by 2031 according to Straits Research.

Collectively, Shopify has a great shot at high-teens revenue growth through the end of the decade. That makes its current valuation of 14.3 times sales seem fair, and it represents a substantial discount to the three-year average of 25 times sales. Investors should feel comfortable buying a small position in Shopify stock today.