Kroger Co posted higher-than-expected quarterly earnings and backed its full-year outlook, holding its own amid heated competition from Wal-Mart Stores Inc and other grocery stores.

Shares of the largest U.S. supermarket chain rose more than 3 percent on Thursday after it affirmed its fiscal-year earnings forecast of $1.60 to $1.80 per share on identical-store sales growth of 2 percent to 3 percent, excluding fuel.

The company, whose brands include Kroger, Ralphs, King Soopers, Fry's and Food 4 Less, said net profit for the first quarter ended May 22 fell to $373.7 million, or 58 cents a share, from $435.1 million, or 66 cents a share, a year earlier.

Analysts on average were forecasting earnings of 54 cents a share, according to Thomson Reuters I/B/E/S.

Many investors were concerned about new pressure from Walmart, which sells more groceries than any other retailer.

Grocery accounted for almost 50 percent of U.S. sales at Walmart last year. Many analysts see the big-box retailer as Kroger's toughest rival and the biggest near-term threat to the overall supermarket industry.

Walmart has been trimming prices on groceries and offering special rollback discounts on certain items, like 24-packs of soda.

Walmart's actions arrived as a bruising price war between Kroger and direct rivals like Safeway Inc and Supervalu Inc showed early signs of easing.

Cincinnati-based Kroger's sales, including fuel, increased 8.7 percent to $24.8 billion in the first quarter, beating analysts' estimates of $24.1 billion. Excluding gasoline, sales rose 3.1 percent.

Identical-supermarket sales -- at stores open without expansion or relocation for five full quarters -- increased 2.4 percent, excluding fuel.

In their race to offer the lowest prices to U.S. consumers made wary by high unemployment and a still weak economy, some supermarket chains have put traffic ahead of profits. As a result, investors have kept a close eye on margins.

Kroger's gross margin including fuel fell 168 basis points to 22.7 percent of sales in the first quarter. Excluding fuel, margins fell 77 basis points.

I am pleased with the strong positive identical-sales growth we achieved in the first quarter while striking a better balance on margin investments, Kroger Chief Executive Officer David Dillon said in a statement.

Shares of Kroger rose 3.3 percent to $20.75 in early New York Stock Exchange trading, while Supervalu was up 2.2 percent and Safeway gained 0.6 percent.

At Wednesday's close, Kroger shares were down 2.2 percent so far this year.

(Reporting by Lisa Baertlein in Los Angeles and Ben Klayman in Detroit, editing by Dave Zimmerman and Lisa Von Ahn)