People are increasingly buying groceries online. And many retail experts believe the digital supermarket battle will come down to Amazon versus Walmart.

But Kroger has something to say about that: Not so fast.

Kroger (KR), the grocery giant that also owns supermarket chains Ralphs, Fry's and Harris Teeter, reported solid sales and earnings Thursday that topped forecasts. Shares surged nearly 10% on the news.

What's even more impressive is that Kroger said digital sales soared by 66% compared to a year ago.

That's a clear sign that moves Kroger is making to court younger tech-savvy shoppers are working.

It also shows that Kroger is now a legitimate rival to Amazon (AMZN) and Walmart. Amazon now owns Whole Foods and Walmart (WMT) has made several acquisitions to boost its online shopping presence.

Kroger launched a program last year called Restock Kroger that focuses on lower prices, more private label brands and an increase in its digital shopping initiatives.

The company's ClickList service, which lets customers shop online for home delivery or curbside pickup at the store, also helped the company report surprisingly strong sales last November.

Kroger has increased its organic offerings through its Simple Truth brand. Sales hit $2 billion in 2017.

The company has also rolled out Prep+Pared Meal Kits, a move to compete with Blue Apron (APRN), HelloFresh and Plated, which was bought by the supermarket chain Albertsons last year.

Kroger has stepped up its online efforts even further this year. It recently bought meal-kit company Home Chef in a deal that could eventually be worth up to $700 million.

And Kroger invested $250 million for a stake in the red hot British online supermarket delivery company Ocado to help manage automated warehouses.

Related: Is Ocado the Microsoft of retail?

It's no wonder that Kroger CEO Rodney McMullen is excited about the future.

"Everything we are doing today will enhance our ability to provide everyone in America with the convenience of shopping for anything, anytime and anywhere," he said during a conference call with analysts.

McMullen added that customers who are shopping online at Kroger and its other chains are spending more per week than those who just buy groceries at the physical stores.

Analysts are impressed with the online growth too.

Neil Saunders, managing director of GlobalData Retail, said in a report that the Ocado and Home Chef deals "both speak to the fact that Kroger is looking to stay one step ahead of the competition by gaining a toehold in rapidly-growing segments of the market."

And Ed Kennedy, senior director of commerce at marketing software company Episerver, said in an email to CNNMoney that Kroger's latest results show it "has adapted to growing customer needs for more seamless and convenient shopping options as part of the everyday grocery shopping."

"Kroger is evolving with its consumer instead of falling behind, and it has paid off," Kennedy added.

In other words, Kroger is not waving the white flag in the online grocery wars. Quite the contrary. It's playing offense, taking it right to Amazon and Walmart to try and beat them at their own game.