Fast-casual chain Chipotle Mexican Grill reported blockbuster second-quarter earnings this week with the news sending its shares surging in after-hours trading. Over the last decade, the company has made investors a significant profit.

Chipotle's stock has been on an upswing recently and its shares are up 80% this year and hit an all-time high Wednesday. The current stock price is around $780.

If you invested in Chipotle 10 years ago, you'd have made a strong profit. A $1,000 investment in 2009 would be worth nearly $8,600 as of July 24, 2019, for a total return of 760%, according to CNBC calculations. By comparison, a $1,000 investment in the S&P 500 would have earned a total return of 280% over the same period.

Chipotle also announced Tuesday that its digital sales almost doubled during the second quarter, beating Wall Street expectations. "We're pleased with our financial performance, which marks the sixth consecutive quarter of accelerating comps and reflects continued progress on our key strategic initiatives," Chipotle CEO Brian Niccol said in a statement.

The company reported earnings per share of $3.99, versus analyst expectations of $3.76. Revenue reached $1.43 billion, compared with the expected $1.41 billion, and same-store sales growth hit 10%, versus the forecast 8.33%.

While Chipotle's stock has done well over the years, any individual stock can over- or underperform and past returns do not predict future results.

CNBC: Chipotle stock as of July 24, 2019.

Given the surge in the fast-casual chain's shares, it appears Chipotle is back on track following food safety issues in 2015, which resulted in 60 customers infected by foodborne illnesses across more than 10 states.

When it comes to same-store sales, which tracks sales performance by store locations open for a year or more, Chipotle came out ahead of company expectations. However, investors should keep in mind that the company is still not performing at the level it was before the food safety issues, warns Stephen Anderson, senior vice president and equity research analyst at Maxim Group.

"Same-store restaurant sales is impressive at 10%, but back in 2012, 2013, 2014 they were doing mid-teens," he said.

Anderson also said food costs could become a concern in the "very immediate future," especially with ingredients such as avocados, which have almost doubled in price since the beginning of the year.

Chipotle is also investing in new ventures. The company is expanding its digital order capability with special pick-up shelves and drive-through windows called "Chipotlanes," and now offers delivery at 95% of locations through DoorDash. The chain opened 20 new stores during the second quarter of 2019, bringing its total to more than 2,500 locations.

If you are thinking about getting into investing, experts often advise starting with index funds, which hold every stock in an index, such as the S&P 500. Seasoned investor Warren Buffett agrees that it's a smart idea to start with index funds, in part because they fluctuate with the market, making them less risky than individually selected stocks.

Here's a snapshot of how the markets look now.

Don't miss: If you invested $1,000 in Netflix in 2007, here's how much you'd have now

Like this story? Subscribe to CNBC Make It on YouTube!