Chipotle Mexican Grill shares rose Tuesday as the company reported better-than-expected earnings, as more customers headed to its restaurants and spent more while they were there.

EPS: $1.60, versus $1.27 expected by Thomson Reuters estimates

Revenue: $1.07 billion, versus $1.05 billion expected by analysts

Sames-store sales grew 17.8 percent, versus expected growth of 14.9 percent, according to Street Account.

Shares of the company rose as much as 6.8 percent after the earnings release, but the gains were erased when the company revealed it had experienced a data breach.

The company posted earnings of $1.60 per share on $1.07 billion in revenue. The burrito chain was expected to earn $1.27 per share on $1.05 billion in revenue, according to Thomson Reuters estimates.

The company's same-store sales grew 17.8 percent in the first quarter, up from the expected 14.9 percent that analysts had forecasted, according to Street Account.

"This is an indication that Chipotle should be through the worst of the fallout from its food safety issues and can now refocus on expansion," Simon Negri, partner in the Consumer Products & Retail Practice at A.T. Kearney, told CNBC.

The company said that sales were boosted by improved consumer traffic, reduced promotional activity and an increase in average check.

"2017 is off to a strong start, as our restaurant managers and teams are energized by our renewed focus on the customer," Steve Ells, CEO of Chipotle, said in a statement Tuesday. "By simplifying the focus in our restaurants to only those elements that lead to a great guest experience, our operations have improved every single month, which gives us confidence that we are on our way to achieve our mission to ensure that great food made with whole unprocessed ingredients is accessible to everyone."

Brian Bittner, an analyst at Oppenheimer, wrote in a research note Monday that the first quarter "represents peak comps," as same-store sales were down almost 30 percent in the same quarter of 2016.

Chipotle reiterated its full-year 2017 outlook for same-store sales to grow in the high-single digits.

However, these gains were overshadowed by the company telling investors that it had detected "unauthorized activity" on a network that supports payment processing for purchases made at Chipotle restaurants. The company said that it believes it has taken the proper steps to stop the activity.

Chipotle said that it is focused on transactions that occurred between March 24, 2017 and April 18, 2017.

Although the stock pulled back slightly from its post-earnings gains, Bret Kenwell, an analyst at InvestorPlace.com, said that "long-term investors have little reason to bail on the stock."

Chipotle's business should gain momentum throughout 2017, which will boost the stock's price, Kenwell said.

"Short-term investors need to be more nimble," he said. "If momentum continues, the 2016 high near $540 could be in play in the near future."