Walmart Stores Inc posted better-than-expected quarterly earnings on Thursday as a clampdown on inventory offset falling sales, and the company forecast a full-year profit that could beat Wall Street estimates, sending its shares up 1.7 percent.

The world's biggest retailer, which now describes itself as Walmart, said the hold-down on inventory helped it protect margins and avoid costly markdowns as cautious shoppers stuck to buying necessities like food.

The company's better-than-expected profit more than outweighed its weaker-than-planned sales given the tough economy, said Peter Benedict, analyst at Robert W. Baird & Co.

All these other stocks have had such big runs, it's time for Walmart to play some catch up, he said of the stock's rise.

Net income fell slightly to $3.44 billion from $3.45 billion but earnings per share rose to 88 cents from 87 cents, as the company had fewer outstanding shares in the latest quarter. Analysts, on average, were expecting earnings of 85 cents per share, according to Reuters Estimates.

Total sales fell 1.4 percent to $100.08 billion, pressured by a stronger U.S. dollar, which cut the dollar-value of sales made outside the United States. Sales rose 2.7 percent to $104.28 billion on a constant currency basis.

The results came out on the same day as a U.S. government report showing that sales at retailers fell unexpectedly in July. Other data showed the number of workers filing new claims for jobless benefits rose in the latest week.

Short term, we believe the economy will continue to be challenging, said CEO Mike Duke on a recorded call. We are accelerating our focus on reducing expenses and improving productivity in all of our operations.

SLIPPING SALES

The retailer said sales at U.S. stores open at least a year -- a key gauge known as same-store sales -- fell 1.2 percent. Wall Street, on average, expected a gain of 0.85 percent.

In May, the company said it would stop posting sales on a monthly basis, leaving analysts to guess how it fared in the quarter compared with last year when it was helped by rising food and fuel prices and consumers spending tax rebate checks.

Vice Chairman Eduardo Castro-Wright said on a recorded call that the company had underestimated how much of a boost it got from shoppers spending tax rebate cash in its stores a year ago. He also said sales were hurt by falling food prices.

Chief Financial Officer Tom Schoewe told reporters that consumers were under significant pressure, preferring to pay for purchases with cash or debit cards instead credit.

Walmart is also seeing a bump in sales at the start of the month when consumers receive government aid such as food stamps, he said.

Sales at Walmart's U.S. stores rose 0.3 percent in the second quarter to $64.21 billion, while they fell 3.2 percent to $11.91 billion in Sam's Club warehouse locations.

In the company's international division, sales fell 5.1 percent to $23.97 billion, but on a constant currency basis international sales increased 11.5 percent to $28.16 billion.

FOCUS ON BACK-TO-SCHOOL, CHRISTMAS

For the back-to-school shopping season, which is now underway, Castro-Wright said he believes Walmart is gaining significant share, and it was pleased with the initial response to its back-to-school merchandise.

When asked about his outlook for Christmas, Schoewe said he was hopeful the season would be better than a year ago.

For the current third quarter, Walmart expects earnings per share from continuing operations of 78 cents to 82 cents. The average Reuters estimate was 80 cents a share.

For the 13 weeks ended October 30, the company forecast U.S. same-store sales to be flat to up 2 percent, with same-store sales at its Sam's Club to be flat, plus or minus 1 percent.

For the year, it forecast earnings from continuing operations of $3.50 to $3.60 a share. Analysts on average forecast $3.53, according to Reuters Estimates.

Wal-Mart shares were up 86 cents to $51.37 in late morning New York Stock Exchange trading.

(Reporting by Nicole Maestri and Brad Dorfman; Editing by Lisa Von Ahn, Derek Caney and Ted Kerr)