NEW YORK, May 13 (Reuters) - Walmart's earnings amid signs of weaker discretionary spending could add fuel to a rally that has propelled its shares to record highs, or potentially spook investors looking to justify the heavyweight retailer's pricey valuation.

As Walmart gears up to report its first-quarter earnings on Thursday, Americans continue to spend heavily online, driven by demand for cheaper products. Known for its bargain-priced merchandise, Walmart is facing especially stiff price competition online from Amazon and newcomers like PDD Group's Temu in key categories such as personal care products, clothing and electronics.

Walmart's stock has climbed 15% so far in 2024, better than the S&P 500's 9% rise, increasing pressure on the company to provide strong results.

Shares of Walmart recently traded at about 25 times expected earnings, up from a 10-year average valuation of about 20, suggesting investors expect strong profit growth, according to LSEG data.

Wall Street anticipates Walmart to report nearly 6% growth in net income for its first quarter ending April 30, per LSEG. Earnings per share are expected to hit 52 cents, the top end of Walmart's forecast provided in February.

But those expectations come as Walmart contends with higher than average inventories. General merchandise, a crucial category for Walmart, generated $114 billion in sales or a quarter of its total revenues in the year ended January 2024.

Walmart replenished its inventories at a slower rate than some of its peers, according to LSEG data for the fiscal quarter ended January 31. Both Kroger and Costco showed better inventory turnover than Walmart, according to LSEG data for their latest fiscal quarters. High inventory levels potentially raise Walmart's costs, jeopardizing its profit margins.

In February, Walmart said its inventory was in "great shape" and that it felt good about its position as it began the new fiscal year.

Americans' spending intentions remain weak compared to 2021, at least for non-essential, discretionary merchandise like clothing, according to Deloitte, which conducted surveys to measure demand.

B. Riley Wealth's chief market strategist Art Hogan said he expects Walmart's shares to trend higher if it beats revenue and earnings estimates on Thursday.

"Walmart has more tailwinds than headwinds and there is room for the stock to grow," said Hogan. He owns Walmart shares as an individual, though his firm does not hold shares.

(Reporting by Siddharth Cavale in New York Editing by Nick Zieminski)