Just because you're at the top doesn't mean you'll stay there long if you don't execute. For many years, Apple (AAPL -0.60%) held on to its claim as the world's largest company. However, thanks to declining sales (for four straight quarters), Apple's lead is slipping and Microsoft (MSFT 1.44%)is closing in.

At the current rate, I wouldn't be surprised if it happened by 2025. So, is it time to hop off the Apple train and adopt a new bedrock stock for every new investor's portfolio? Let's find out.

Microsoft is closing the gap rapidly

When discussing the world's largest company, I'm referring to its market cap, which is calculated by multiplying its share price by the number of shares outstanding. Essentially, it's how much money one would have to pay to own the company outright.

MSFT Market Cap Chart

MSFT Market Cap data by YCharts.

While Apple maintained a fairly even spread throughout the past three years (besides a small period when Microsoft briefly overtook Apple), that gap has narrowed to under $150 billion. While that is a massive gap in its own right, it only represents a 5.3% gain in Microsoft's stock price or a 5% fall in Apple's.

That amount of movement can easily happen in a week or a month, so why do I think it will be 2025 before Microsoft truly takes over the title? While Microsoft may momentarily accomplish this task, I'm not concerned about one- or two-week movements; I want to see permanent control of the world's largest company title.

At the current rate, I think 2025 will be an easy-to-hit goal for Microsoft.

Microsoft's business focus will lead the company higher

The most recent set of quarterly results for this pair couldn't have been more different. Apple's revenue declined by 1%, while Microsoft's increased by 13%. This shouldn't come as a surprise as Apple's revenue streams are extremely consumer-facing. With the current state of the consumer plus housing prices soaring and inflation still taking a toll on wallets, Apple may struggle for a while.

On the other hand, Microsoft's cloud computing, artificial intelligence (AI) copilot, and other business solutions continue to grow rapidly. Microsoft is at the crossroads of two important business shifts: cloud computing and AI. As a result, its growth should remain healthy for some time. Even if the consumer regains their strength, it would be a large surprise for Apple's growth rate to be faster than Microsoft's.

Because of this stark difference in each company's outlook, the stocks trade for different price-to-earnings (P/E) ratios.

MSFT PE Ratio Chart

MSFT PE Ratio data by YCharts. PE Ratio = price-to-earnings ratio.

Microsoft earned its premium to the market (the S&P 500 trades for 25 times earnings), although Apple hasn't recently. The stock is currently relying on past execution to vouch for its current state, which doesn't seem like a winning investment strategy.

Microsoft has shown itself to be the better investment over the past year. With its exposure to key business trends, it should continue to put up strong growth and grow its earnings at a rapid pace. Apple will have to wait for the consumer to recover, taking the ball out of its court. Plus, with the smartphone renewal cycle elongating, Apple's business may struggle for a few years.

As a result, I think Microsoft will take the torch of the world's largest company monetarily throughout 2023 and 2024 but secure it for good starting in 2025.