Buying an undervalued stock is the goal of almost every investor. Whether you're value or growth focused, it doesn't matter -- you're still trying to buy something for less than what it's worth. At the beginning of 2023, you could close your eyes and pick an undervalued tech stock, and chances are you'd be up at least 25% on your investment. Now, finding value is a bit tougher.

Still, one stock with massive upside potential has remained drastically undervalued: MercadoLibre (MELI 3.09%). This company is often called "the Amazon of Latin America," but when you dig in, you'll find out that it's quite more than that. Read on to find out what makes MercadoLibre undervalued and why it's an excellent buy right now.

Q2 was incredible for MercadoLibre

MercadoLibre started out as Latin America's e-commerce source. Like Amazon, it also expanded into logistics for delivering packages. However, one area where it is superior to Amazon is its fintech wing.

Mercado Pago handles digital payments for its e-commerce division and has become a popular app for peer-to-peer transactions. Furthermore, it launched a credit division in this area that has proven to be highly successful.

With MercadoLibre, you get a one-two punch of e-commerce and fintech, and one business can bolster the other if it's going through a rough patch. However, in Q2, each performed strongly, with commerce net revenue growing at a currency-neutral 65% year over year and fintech rising 48% year over year. This is a complete reversal of last year's results, where commerce only grew at 23% while fintech blazed 107% higher.

Overall, MercadoLibre's revenue grew 57% on a currency-neutral basis, or 32% when those effects are stripped out. While those growth rates are impressive, its operating margin really impressed investors. In Q2, it was 16.3%, up 6.7 percentage points from last year's Q2 and 5.1 percentage points from just one quarter ago.

This is key for MercadoLibre, as thecompany has proven that it can grow all day long in the emerging Latin American economy, but it hasn't proven it can do so profitably. With the change in the narrative, investors can sleep more comfortably with MercadoLibre in their portfolio.

But what makes this stock undervalued?

The stock hasn't been this cheap in nearly 15 years

From a price-to-sales (P/S) basis, MercadoLibre's stock hasn't been this cheap in a very long time.

MELI PS Ratio Chart

MELI PS Ratio data by YCharts

Not only is it trading below a historical range of 8 to 12 times sales, it's essentially at the same levels it posted during the Great Recession in 2009. From that standpoint, the stock looks dirt cheap.

However, we just discussed how MercadoLibre was becoming more profitable, so looking at its price-to-earnings (P/E) ratio is also a wise task. Unfortunately, the picture isn't as attractive here.

MELI PE Ratio Chart

MELI PE Ratio data by YCharts

At 89 times trailing earnings and 66 times forward earnings, MercadoLibre is far from what anyone would consider cheap. But with net income rising 113% in Q2, this narrative could quickly flip after a couple of years of earnings. Plus, with MercadoLibre being a foreign company, it's harder to accurately predict its results, as many analysts don't live in a region where they can see its products at work.

As a result, I'm not too concerned with MercadoLibre's high P/E ratio, as it will drastically come down if the company continues to post impressive quarters as it did in Q2. Even though the P/E ratio may not indicate an undervalued stock, the P/S ratio does. And with massive growth still ahead for MercadoLibre, it looks like an excellent stock to buy right now.