The year 2017 was great for e-commerce companies. It seemed as if everyone with even a toe in the industry saw their stock price outpace the market. Even the global leader in e-commerce, Amazon.com, saw its shares grow 56% last year, and shares are up another 20% so far in 2018.

After a year of e-commerce stocks running higher, valuations may seem stretched for a lot of companies. But here are five e-commerce stocks investors can still buy today.

Going once, going twice...

Before seemingly everyone in America was an Amazon Prime subscriber, eBay (NASDAQ:EBAY) was actually the leader in online commerce, for a minute. Gross merchandise volume (GMV) on eBay far exceeded Amazon's sales in the early 2000s, but it was quickly supplanted in the latter half of the decade.

Over the past year, eBay's GMV totaled $86 billion across its flagship platform and StubHub -- its event-ticketing platform. That's significantly smaller than Amazon, and it's not growing as quickly. But what's most interesting about eBay's results is that GMV growth accelerated in the third quarter, up 8% from the prior year's third quarter and higher than the second quarter's 3% jump in GMV.

Management has taken a back-to-basics approach, focusing on eBay's unique product selection, as well as improving the tools available to sellers, and working on algorithms to improve the user experience and improve its visibility in search engines. The efforts are already paying off, and management expects continued high-single-digit revenue growth for the foreseeable future. As eBay starts to turn around, now could be a great time to buy shares.

A drone carrying a package from JD.com

Image source: JD.com.

The Amazon of China

JD.com (NASDAQ:JD) is often compared to Amazon.com because it's China's largest first-party online retailer. Investors looking to get in on the e-commerce megatrend as well as the growing middle class in China would be well served by JD.com.

JD.com benefits from a strong brand that stands for authentic products and fast delivery, which enables it to fend off smaller competitors. As a result, it has quickly taken a growing share of online retail in China. As of the end of 2016, JD.com had a 25% share of business-to-consumer e-commerce in China, versus 18% two years prior.

The company isn't profitable, but it should be soon. Management expects to become profitable on a GAAP basis this year, and analysts are expecting 25% adjusted earnings growth over the next five years.

The most recent catalyst for growth at JD.com is its planned entry into the U.S. market. It intends to lean on its fulfillment capabilities and its partnership with Wal-Mart to support quick delivery times. The move should separate it from other Chinese importers, which can take weeks to fulfill orders to the United States.

Mercadolibre's logo broken into jigsaw puzzle pieces.

Image source: MercadoLibre.

Don't forget about South America

The growth of e-commerce is a global phenomenon, so any company that has things running well and ahead of the pack in a fast-growing economy should see excellent results. That brings us to MercadoLibre (NASDAQ:MELI), the leading e-commerce platform in Latin America. It has seen its shares soar 145% since the beginning of last year, but it might not be too late to buy shares and capitalize on the growing business.

Last year, MercadoLibre started taking plays right out of Amazon's book, expanding its free shipping and loyalty programs. The results were seen in the company's fantastic top-line growth; revenue climbed 61% year over year (79% on a local currency basis) in the third quarter. It's also showing up in its gross margin, which contracted 48% in the third quarter as MercadoLibre footed the bill for more of its shipping.

But MercadoLibre's efforts to push more customers to its platform with incentives like free shipping have additional benefits. It's also attracting more customers to its payments platform MercadoPago, and its shipping platform MercadoEnvios. In the most recent quarter, total payment transactions on MercadoPago climbed 69%, and MercadoEnvios shipped 80% more packages than last year. The result is a network effect that will be tough for any competitor, even Amazon, to overcome.

Modern lounge chairs next to swimming pool

Image source: Getty Images.

The leader in online travel

Don't let Priceline Group's (NASDAQ:BKNG) tepid fourth-quarter outlook ruin your travel plans. Investing in the online travel agency could provide you with the extra funds needed to extend your vacation an extra day or two.

Shares of Priceline dipped after posting lackluster results over the summer as traffic growth slowed when management began pulling back on some advertising channels. Inclement weather in North America also resulted in less travel during peak season.

But the underlying health of the company remains strong. Its position at the forefront of online travel booking, particularly in Europe, provides investors with an excellent way to ride the growing trend.

Priceline's dominance in Europe is notable because most hotels in the region are boutique, and therefore rely on travel agencies like Priceline for marketing and online booking. And because of their small budgets, they're unlikely to partner with more than one agency. As of the end of the third quarter, Priceline's Booking.com had about 657,000 hotel property listings, providing a considerable moat against the competition.

Expedia Inc. logo

Image source: Expedia.

Why not buy No. 2 as well?

Priceline isn't the only great stock in the online travel agency market, which qualifies as e-commerce. Expedia (NASDAQ:EXPE) also presents a great buying opportunity for investors interested in the rapidly growing space. Recent investments in the integration of its brand portfolio and extending technology to more websites have weighed on profits and its stock price. But just like Priceline, the long-term story is still intact.

Expedia aggressively acquires brands across various geographic markets. Its portfolio includes Orbitz, Hotels.com, Travelocity, Hotwire, HomeAway, and a 60% stake in Trivago, among others. Expedia can then leverage its marketing and technology expertise to revitalize the brands as it did with Travelocity a couple of years ago.

Expedia's strategy enables it to expand market share organically, which should translate into higher profit margins as the company scales. While it's not quite the same size as Priceline, Expedia is a close second and thus benefits from similar competitive advantages over the rest of the industry.

Finding a good buy in an overstretched market

With the run-up in e-commerce stocks over the past year or so, it's getting harder to find stocks that don't seem too expensive.

Sometimes, however, it's worth paying a premium on a stock with excellent growth opportunities in emerging markets, as is the case with JD.com and MercadoLibre.

Other times it's worth taking a stab at a company working to accelerate its business and catch up with the competition.

And then there are always opportunities to find companies that can still benefit from a trend, but due to other reasons have been beaten up by the market -- as is the case with Priceline and Expedia.

The above five companies represent great buying opportunities in the e-commerce space.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Adam Levy owns shares of Amazon and Priceline Group. The Motley Fool owns shares of and recommends Amazon, eBay, JD.com, MercadoLibre, and Priceline Group. The Motley Fool recommends Expedia and Trivago. The Motley Fool has a disclosure policy.