Apple (AAPL 0.52%) and Microsoft (MSFT -2.45%) have battled one another for leadership in the tech industry for nearly 40 years.

Today, both have become radically different companies run by a new generation of leadership. Still, the rivalry between these tech stocks continues. Apple remains a leader in smartphones and wearables. Conversely, Microsoft has successfully redefined itself as a cloud company.

Since both tech giants have positioned themselves to prosper, choosing between them likely hinges on who can drive more near-term growth.

Man holding global network concept in his hands with a sunset in the background.

Image source: Getty Images.

The state of Apple

The race for the world's largest market cap remains tight. So far, Apple leads with a market cap of about $1.72 trillion. Like most retailers, Apple has suffered as COVID-19 forced the closure (and sometimes the re-closure) of some of its retail stores. Investors will probably not know the full effects of the coronavirus pandemic on its financials before the company announces its third-quarter earnings on July 30.

Before the pandemic, Apple had suffered as the iPhone, its largest revenue driver, found its sales numbers hammered by competition from other low-cost phones.

Nonetheless, the wearables business looks poised to become the company's next great revenue source. Net sales rose by more than 22.5% in the most recent quarter. Moreover, with the need for 5G capability, the iPhone appears due for another upgrade cycle. Additionally, with COVID-19 forcing more people to work from home, computers could see a significant resurgence in demand.

Consequently, the stock has surged to all-time highs. It has also risen to a forward P/E ratio of approximately 25.5.

AAPL Chart

AAPL data by YCharts

It was only last year that the forward P/E ratio consistently rose above 20. If optimism about revived iPhone and computer sales does not materialize, the stock could fall back in the near term.

Still, Apple holds more than $192.84 billion in available capital and has long shown a tremendous ability to generate shareholder return. These factors alone almost ensure its long-term future regardless of what happens in the short term.

Where Microsoft stands

Apple's longtime rival has staged a dramatic comeback since a decline in PC sales hurt software sales and conversely its stock. Current CEO Satya Nadella has since remade Microsoft into a cloud giant. At a $1.63 trillion market cap, Microsoft has grown to become nearly as big as Apple, when comparing market caps.

This happened mostly by becoming Amazon.com's biggest competitor in the cloud computing realm. In the most recent quarter, the company's intelligent cloud division saw a 29% revenue increase when measured in constant currency.

One unexpected side effect is that Microsoft was in a sweet spot when it came to the pandemic. Due to a sudden need for more remote work, demand for cloud services has spiked. Investors will probably not know the extent of this effect until the company releases its fourth-quarter earnings on July 22.

This has also made Microsoft a more digital company, so much so that it announced in June that it is going to close all of its retail locations.

MSFT Chart

MSFT data by YCharts

Microsoft stock currently trades at a forward P/E ratio of around 34. While on the surface, this makes Microsoft seem more expensive than Apple, Microsoft's revenue growth has supported a higher P/E than Apple consistently over the last five years. Also, Microsoft does not hold quite as much cash in reserve. Still, with $137.63 billion in cash or short-term investments, Microsoft is in a similar position to Apple in terms of having the funds to control its own destiny.

Apple or Microsoft?

Both stocks are worthy of buy recommendations. However, I think cloud growth gives Microsoft a slight edge. According to Gartner Research, the worldwide public cloud industry will grow by 17% this year. This is the highest growth rate among all market segments.

Despite Microsoft's potential in the short term, investors should note that this is one of the few times since the early 1980s that both companies are at the top of their game at the same time. With both Apple and Microsoft driving future growth in tech, look for each of them to reach the $2 trillion market cap and beyond in the not-too-distant future.