Investors did not like what Kroger had to say Thursday when it released weaker-than-expected fiscal fourth-quarter earnings that showed a drop in profit as the company struggles to compete against retail giants Walmart and Amazon.

The grocer's shares fell 12 percent — erasing about $2.8 billion in market value — after the company missed Wall Street earnings and revenue estimates for the quarter ended Feb. 2 and warned that its fiscal 2019 earnings will be worse than anticipated.

"We understand that we have our work cut out for us, and we saw that in the market this morning," CEO Rodney McMullen told analysts on the conference call.

Shares of smaller grocers Sprouts, Weis Markets, Village Super, Ingles Markets and Natural Grocers all opened lower Thursday.

Kroger's earnings took a hit as it closes out the first of three-year investment plan that pours money into digital sales and delivery services to keep up with shifting consumer shopping habits. The company's gas stations also suffered from a drop in gas prices that cut sharply into revenue.

Digital sales jumped 58 percent during fiscal 2018, and the company said it expanded its pickup or delivery programs to reach 91 percent of its customers — all part of its strategy to compete with Walmart and Amazon. During the fourth quarter, the company opened more warehouses for the division.

"We're very bullish on our digital business," outgoing CFO Michael Schlotman said Thursday on CNBC's "Squawk Box."

After adjusting its earnings to exclude expenses from its pension plan, a derivatives loss and other items, Kroger earned 48 cents per share, missing the 52 cents per share expected by analysts surveyed by Refinitiv.

Net sales during the quarter dropped 9.5 percent to $28.09 billion, falling short of expectations of $28.38 billion. However, sales increased by 1.6 percent when not factoring in fuel, an extra week in 2017, the convenience store divestiture and a merger with meal kit company Home Chef.

Looking to fiscal 2019, the company expects to earn $2.15 to $2.25 per share, a more pessimistic range than expected by analysts. Wall Street was forecasting Kroger to earn $2.26 per share this year. Schlotman told analysts on the conference call that the company was expecting fuel would be a headwind in 2019.

"We do expect softer fuel results this year," incoming CFO Gary Millerchip told analysts.

On an unadjusted basis, the grocer's profits slid 69.7 percent to $259 million, or 32 cents per share, during the quarter from $854 million, or 96 cents per share, a year earlier.

Schlotman told CNBC that the roughly 10 cent drop in gas prices from a year earlier accounted for the majority of the quarter's revenue decline.

Excluding fuel, sales at stores open for at least five quarters grew by 1.9 percent during the fourth quarter. Schlotman credited the weather and early disbursements under the Supplemental Nutrition Assistance Program due to the government shutdown. The grocer is targeting same-store sales sales growth, excluding fuel, of 2 to 2.25 percent in fiscal 2019.

While consumer packaged goods companies like Hershey and Procter & Gamble have been hiking prices, Schlotman said Kroger has been able to negotiate the cost of goods. In cases when prices on those products do rise, the company said that Kroger's private label brands tend to gain market share.