Chipotle Mexican Grill on Wednesday reported earnings and revenue that beat analysts' expectations after doubling its digital sales during the quarter.

After the markets closed, shares of the company initially surged 4% but have since lost those gains.

"The on-going improvement in each of our key operating metrics over the past few quarters gives us confidence that our mission to win today and cultivate the future, is resonating," CEO Brian Niccol said in a statement.

Here's what the company reported compared with what Wall Street was expecting, based on a survey of analysts by Refinitiv:

Earnings per share: $3.40, adjusted, vs. $3.01 expected

Revenue: $1.31 billion vs. $1.27 billion expected

Same-store sales growth: 9.9% vs. 7.29%

Chipotle reported fiscal first-quarter net income of $88.1 million, or $3.13 per share, up from $59.4 million, or $2.13 per share a year earlier.

Excluding expenses related to restaurant asset impairment, corporate restructuring and other costs, the Mexican food chain earned $3.40 per share, topping the $3.01 per share expected by analysts surveyed by Refinitiv. Price hikes at the end of 2018 helped lower food, beverage and packaging costs but were partially offset by more demand for steak.

Net sales rose 13.9% to $1.31 billion, beating expectations of $1.27 billion.

Notably, digital sales rose 100.7% during the quarter, accounting for 15.7% of total sales. Executives would not disclose what percent of digital sales are delivery orders.

In March, Chipotle launched its points-based loyalty program nationwide. Less than a week later, the company surpassed its one millionth member, who scored a year's worth of Chipotle. The program has already helped mobile app downloads soar, according to a Barclays note. The company plans to use consumer data to better target loyalty program members.

During the company's earnings conference call, Niccol said the rewards program has grown to 3 million members.

The loyalty program is just one part of Chipotle's strategy to build digital engagement. The company has a partnership with third-party delivery service DoorDash. At the end of 2018 and in the first week of 2019, Chipotle offered free delivery to promote the partnership. Niccol told investors that nearly half of the free delivery burrito bowls were new or lapsed customers. Even after the promotion ended, Chipotle saw increased customer retention.

Whereas some restaurants have seen third-party delivery services' hefty commission fees offset the benefits of delivery, executives said that delivery actually helped raise its operating margin to 21% this quarter.

It has also been investing in changes to its restaurants to make delivery and digital pick-up easier for customers, like pick-up shelves and drive-through windows called Chipotlanes.

Same-store sales grew by 9.9%, driven by a 5.8% increase in restaurant transactions. This is the fifth consecutive quarter that Chipotle has seen same-stores growth. The reported same-store sales number includes a 0.30% negative impact in anticipation of customers redeeming loyalty program rewards.

The company raised its same-store sales outlook for 2019. It is now forecasting mid-to-high single-digit sales growth at stores open at least a year. It previously said that it was expected mid-single digit growth.

The company opened 15 stores and closed 2 locations during the quarter, bringing its total restaurant count to 2,504. Chipotle reiterated its forecast of opening between 140 to 155 stores during 2019.

Second-quarter food costs are expected to rise 1% because of avocados. The chain is known for charging extra for its guacamole, but that won't shield it from rising avocado prices that began to hit the company in late March. Hartung said that Chipotle is forecasting higher prices due to higher demand from retailers and lower supply from California growers.

Investors have been optimistic about the chain under Niccol's leadership. When he was head of Taco Bell, he was known for developing innovative products. At the end of March, the company's stock price hit $700 per share for the first time since 2015, when a multistate E. coli outbreak linked to Chipotle sent shares plunging. The stock is up more than 64% so far in 2019.

"They are on a pathway back, but I think one of the key [reasons] has been the marketing and pushing more the dollars towards the national marketing versus local marketing," BTIG analyst Peter Saleh said on CNBC's "Closing Bell."

In 2018, Chipotle launched a national advertising campaign "For Real," which focuses on its ingredients. Two months ago, it released "Behind the Foil," documentary-style ads that show how the chain prepares its ingredients before they land in a customer's burrito.