(Reuters) - Kroger Co KR.N issued an upbeat holiday forecast and better-than-expected quarterly results, helped by aggressive discounts that lured more shoppers to its supermarkets, and shares soared as much as 13.6 percent.

The results suggest that Kroger is successfully responding to a new wave of competition from traditional rivals like Wal-Mart Stores Inc WMT.N and Aldi, as well as new entrants such as Amazon.com/Whole Foods AMZN.O and German discounter Lidl.

“Based on the wall of worry over Amazon, Walmart and Aldi, fundamental concerns over Kroger’s competitive position proved to be overblown,” said Pivotal Research Group analyst Ajay Jain. He added that Kroger’s year-over-year earnings in the period improved for the first time in four quarters.

Kroger managed to boost gross margins more than anticipated. It posted more sales of higher-profit, private-label products as it also lowered its overall cost of goods, which took some pain out of its significant price cuts.

After booking its best-ever “Black Friday” results for general merchandise, Kroger now expects fourth-quarter sales at identical stores open at least a year to exceed 1.1 percent.

But the company, which operates some 2,800 U.S. supermarkets under banners including Ralphs, Harris Teeter and Food 4 Less, is not out of the woods yet. It is locked in a brutal grocery price war and a multi-front fight for a “share of the stomach.”

The company launched “Restock Kroger” in October to strengthen its position. Among other things, it has begun levying fines for late supply deliveries, which improves product selection and curbs waste.

Kroger is also expanding online services that include home delivery and “ClickList” curbside pickup.

It expects “Restock Kroger” to generate $400 million in incremental operating profit margin over the three years from 2018 to 2020.

Shares in Cincinnati-based Kroger were up 8.1 percent at $26.37 in early afternoon trading after hitting a session high of $27.70.

But even with Thursday’s gain, the stock remains down more 20 percent this year. It trades at a price-to-earnings ratio of 14.8 percent, compared with 29.2 for Wal-Mart, its chief rival.

Profit rose 1.5 percent to $397 million, or 44 cents per share, for the third quarter ended Nov. 4, and total revenue rose 4.5 percent to $27.75 billion. That topped analysts’ targets of 40 cents per share on sales of $27.46 billion, according to Thomson Reuters I/B/E/S.

Kroger also reaffirmed its 2017 adjusted earnings per share forecast of $2.00 to $2.05, just above analysts’ average target of $1.97 per share.