Image source: Getty Images.

Investors looking for strong companies with big competitive advantages need to look no further than (AMZN -0.34%) and Baidu (BIDU -0.58%).

A high-level view

Amazon's success in building the leading online retail business is no secret, and the company continues to expand its business prospects as it looks to technology devices, media services, fashion, and even auto parts to find new areas to grow. 

Meanwhile, Baidu resides on the other side of the world and has built the dominant search platform in China. The company fields more than 80% of all online search queries in the country and invests its money in long shots just like Amazon. In fact, Baidu is a major player in the driverless car space and rivals even Google's technology.

Both companies' stock prices have brought solid gains over the past fives years, but Amazon has clearly outpaced Baidu:

Image source: YCharts.

So how well can we expect these two companies to perform over the coming years? Let's take a quick look at how the companies are doing now and see if the good times will keep coming.

Amazon vs. Baidu

Baidu brought in $2.7 billion in total revenue in the second quarter of 2016, representing a 10.2% year-over-year increase. While that's not stellar growth, the company's large size and overall stability mean that revenues are stable, as opposed to skyrocketing. It's worth pointing out that the company's annual revenues are growing at a healthy pace, with 2015 revenues hitting $10.25 billion, up from $7.91 billion in 2014.

The vast majority of Baidu's revenue comes from its online marketing and advertising. It's not a bad way to earn a buck -- just ask Google -- and Baidu is pretty good at it. The company does face some competition in the space though as Chinese e-tailer Alibaba is expected to surpass Baidu's digital ad market share this year.

Part of Alibaba's gain on Baidu comes from new advertising regulations that were recently put into place in China (some of Baidu's previous ads weren't clearly marked as such, and looked like normal search results). That has given some of Baidu's competitors a leg up in the digital advertising space and will hurt the company's ad revenue growth this year. It's expected to grow at just 0.3% compared to Alibaba's 54%. 

For Amazon, net sales reached $30.4 billion in Q2 2016, up 31% year over year. And in 2015, the company's revenue grew at a healthy clip of 20% year over year. Aside from strong revenue growth, the company continually invests in potential revenue streams including tech devices, media content, fashion merchandise, everyday essential products, and auto parts. These often result in changes that fuel Amazon's competitive advantage. Add Amazon's estimated 63 million Prime members to all that, and the company's moat becomes even wider. 

When it comes to valuations, Amazon's forward P/E (a valuation based on projected earnings) is currently sitting at around 77 and Baidu's is at about 30. That puts Amazon's stock price at a higher premium than Baidu's at the moment.

Which is best?

As for the better long-term investment, I'd have to go with Amazon. Baidu's internet search dominance likely won't disappear any time soon, nor will Amazon's online retail position. Both companies will continually expand into new endeavors and their investors will likely benefit from it.

But Baidu's recent problem of displaying ads that look like search results is hurting revenue growth right now and helping its competitors muscle into the space . 

Baidu will likely bounce back from all of this over the long term, but it's enough to hurt the company over the coming quarters, and gives Amazon the slight advantage in this head-to-head comparison.