It's been a rocky road for the Nasdaq Composite over the past few years. But after slumping 33% in 2022, it soared 43% last year, and this bullish trend has persisted into early 2024.

Interestingly, the Nasdaq has demonstrated a solid ability to rebound for at least a couple of years after downturns. For example, after declining nearly 32% in 2002, the Nasdaq jumped about 50% and 9% respectively in 2003 and 2004. And, after crashing by almost 41% in 2008, the technology-heavy index posted hefty returns of around 44% and 17% respectively in 2009 and 2010.

With this pattern in mind, there's good reason to expect decent performance from the Nasdaq in 2024. And with artificial intelligence (AI) emerging as a major investment theme, this trend could well continue. Against this backdrop, here's why Microsoft (MSFT 1.82%) and Meta Platforms (META 0.43%) are smart buys now.

Microsoft

Microsoft, a stalwart in the technology sector, delivered outstanding results for its fiscal 2024's second quarter (ended Dec. 31, 2023), surpassing consensus estimates in revenue and earnings. Not surprisingly, shares of the company have gained nearly 54% in the past year.

At the heart of Microsoft's recent success lies its strategic embrace of generative AI through a long-standing partnership with ChatGPT developer OpenAI. Microsoft's cloud computing platform Azure is rapidly capturing market share thanks to its focus on offering innovative cloud-based AI services. Azure accounted for a 24% share of the enterprise spending on cloud infrastructure services in the fourth quarter, up from 23% in the previous quarter.

Azure's superiority in training and inferencing large language models has positioned it as the preferred choice for AI workloads. Moreover, Microsoft's strategy of offering diverse AI software models and AI chips integrated deeply with Azure infrastructure has attracted a sizable customer base of 53,000 Azure AI users. Since one-third of these customers have been new to Azure itself over the past 12 months, AI services are also playing a pivotal role in expanding Azure's overall market presence.

Microsoft has recently introduced a suite of AI-powered features called CoPilot, which are seamlessly integrated into the company's core products to improve their productivity and efficiency. Additionally, the company has further expanded CoPilot's target addressable market by offering out-of-the-box integrations with third-party applications. With widespread adoption expected across various sectors, CoPilot can have a significantly positive impact on the company's average revenue per user in the coming months.

Beyond AI, Microsoft's core PC and gaming businesses are also exhibiting resilience and potential for expansion.

Microsoft stock is currently trading at just under 37 times trailing-12-month earnings and about 13 times sales, which is quite expensive. However, this premium is justified considering the company's proven track record of innovation and its prowess in the AI market -- making it a compelling investment option for 2024.

Meta Platforms

After a dramatic sell-off in 2022, social media giant Meta Platforms has made a staggering turnaround, with shares surging by almost 164% in the past year. The stock has even spiked recently by nearly 20% in a single day after posting stellar fourth-quarter 2023 results and solid guidance for the first quarter of fiscal 2024.

According to Magna, U.S. ad spending on social media platforms is expected to grow year over year by 11.9% in 2024. With 3.2 billion people using at least one of its applications (including Facebook, WhatsApp, Threads, Instagram, and Messenger) daily, Meta seems well-positioned to capitalize on this growing market opportunity.

Furthermore, the company's focus on cost-cutting and efficiency optimization has also played a major role in driving up its operating margins to 41% in the fourth quarter of fiscal 2023, up from 20% in the same quarter of the prior year.

According to Insider Intelligence, Meta is expected to account for a 20.4% share of U.S. digital advertising sales in 2024. To further strengthen its dominant position in the digital advertising landscape, the company has been increasingly leveraging AI technologies to increase user engagement on its social media platforms and improve ad performance.

Meta has been working on unifying its AI-powered video recommendation system across all of its applications. This is expected to provide users with the best content across applications, thereby resulting in an improved user experience. The company also plans to use its AI-powered chatbot assistants to boost user engagement and help users interact with businesses and creators.

Meta continues to invest in its AI-powered Advantage+ portfolio of solutions to help advertisers automate ad creation and audience targeting while controlling costs. The company has also introduced generative AI features in ad creative tools in areas such as text variations and image expansion, which have been rolled out globally and are already providing value to advertisers. Although in an early stage, these features are expected to be meaningful revenue contributors over time.

Meta is currently trading at 8.8 times its trailing-12-month sales, significantly higher than its five-year average of 6.8. However, the premium seems justified considering the company's large and engaged user base, improving financials, and robust AI initiatives. Hence, the stock seems a smart pick now, even at the current elevated valuation levels.