Artificial intelligence (AI) stocks were without argument one of the biggest drivers of stock market gains over the past two years. Investors piled into companies across the industry -- from designers of AI chips to builders of cloud infrastructure. This momentum paused in the early part of this year as investors turned their attention to the economic situation -- and the potential impact of President Donald Trump's import tariffs.
But the good news is, the situation is starting to brighten once again for companies in the AI space. Trump recently struck a deal with China at a tariff level that was lower than expected, which has offered the market optimism on two points. First, trade tensions may not push the economy into a recession, and second, any potential tariffs on electronics imports likely will be set at a manageable level.
As a result, AI stocks have started to rebound from lows reached in recent weeks. But they still remain at interesting price levels, making now a great time to get in on them.
Wall Street is optimistic that both Meta Platforms (META 0.27%) and Microsoft (MSFT 0.68%) could be stock market winners in the months to come. Which one makes the better buy, though? Let's find out.

Image source: Getty Images.
The case for Meta Platforms
You may mainly associate Meta with its social media platforms. After all, the company owns the most recognized names in the space, from Facebook and Messenger to WhatsApp and Instagram -- and more than 3.4 billion people globally use at least one of these daily. In fact, these apps are Meta's ticket to revenue, as advertisers spend to reach us across the apps, resulting in billions of dollars in quarterly revenue for Meta.
But Meta doesn't focus only on social media. The company also has committed to building its presence in AI, a move that should help strengthen its AI platform and drive more revenue there -- and potentially open up the route to new products and services.
Meta has created large language model Llama, a tool that powers its AI offerings such as Meta AI, the world's most-used AI assistant. The company has made Llama open source, so that others can contribute to its development -- a move that could help Meta's program grow more quickly and set the company up for leadership in AI.
It's important to note that Meta has the resources to do this, as it's built a strong earnings track record, and even pays a dividend to share the wealth with investors. This means it can commit to plans, such as its goal to spend as much as $72 billion on infrastructure this year alone.
The case for Microsoft
As you probably know, Microsoft is a software giant, most likely powering much of the work you do on your computer on a daily basis. This has helped Microsoft increase earnings over time and become the world's most valuable company, with a market value of $3.4 trillion.
But Microsoft also has been one of the early winners in the AI space thanks to its use of AI across its operations. The company uses AI in its software for individuals and businesses to improve performance and analytics, it's invested in ChatGPT founder OpenAI as a key partner, and Microsoft's cloud business offers AI tools and services to customers.
"From AI infra and platforms to apps, we are innovating across the stack to deliver for our customers," CEO Satya Nadella said in the recent earnings report.
Microsoft is already benefiting from its AI investment. In January, the company said its AI business had surpassed an annual revenue run rate of $13 billion, representing a 175% year-over-year gain. So, Microsoft has been generating significant growth thanks to AI, and considering the AI boom has much farther to go, this leader could continue along this positive path.
It's also important to note that Microsoft is one of the world's biggest cloud providers, making it easy for these customers to choose Microsoft for their AI projects.
Should you buy Meta or Microsoft?
Wall Street analysts predict about 11% gains in the coming 12 months for each of these top AI stocks from their levels as of May 20. And, as mentioned, it's clear they both have what it takes to benefit from the AI boom. So this is a difficult choice, as both Meta and Microsoft are solid, profitable companies, and they are well positioned to gain as this hot technology advances.
Let's look to valuation for some help. And here we can see that one may represent a cheaper buy right now.
META PE Ratio (Forward) data by YCharts
Both stocks have recovered from lows reached a few weeks ago, but Microsoft already has become more expensive than it was earlier in the year -- Meta hasn't.
While both stocks are great AI companies to own, if I could only choose one, I would go for Meta today, as it still looks cheap, considering its long-term AI prospects.