Target (TGT -0.70%) shares have been in the doldrums over the past year -- and so have the company's earnings. High inflation and worries about a possible recession are weighing on consumer sentiment. As a result, shoppers are spending less on discretionary purchases, which are a big part of Target's revenue picture.

But before you hit the "sell" button on your Target shares -- or decide to avoid adding the stock to your portfolio -- take a look at one particular number in the fiscal first-quarter earnings report that the retail giant delivered this week. This number may change your mind about the stock.

Meeting and beating forecasts

Before we get to what that number is, though, let's quickly summarize Target's results for its fiscal Q1, which ended April 29. The company's sales met its own expectations, while adjusted earnings per share and operating margin beat its forecasts. Traffic increased, indicating more people are shopping at Target.

Still, the path remains bumpy. Comparable sales came in flat year over year as inflation continues to squeeze customers' wallets. In fact, spending in discretionary categories continued to weaken during the quarter. It slipped in April compared to earlier in the year, executives noted on the Q1 earnings call.

But here's the good news. Target is managing that headwind, and it's seeing results. This brings us to that number I was talking about. Target reported $1.3 billion in cash flow from operations in the quarter. That's compared to an outflow of nearly $1.4 billion in the prior-year period.

Look more closely at the earnings report, and you'll see that much of that improvement has to do with its inventory investments. In recent times, the company has made managing inventory a big focus.

It finished the fiscal quarter with a 16% decline in inventory compared to the same period last year. A lot of this had to do with limiting stock in discretionary categories -- those areas where Target has seen a significant slowdown. It cut its inventory in discretionary items by 25% year over year.

At the same time, Target increased inventory in the areas of food, beverages, and other essentials. Thanks to this effort, the out-of-stock status of key items in these categories fell to a three-year low. Meanwhile, management also thought long term and invested in other types of items that generally boost sales -- such as everything students will need for the back-to-school season.

Keeping customers coming back

At the same time, Target is offering promotions to keep customers coming back today -- and later, when the economy improves and they'll have more money to spend. For example, the retailer recently unveiled swimwear collections starting at only $12.

Target's troubles aren't over. It continues to face headwinds linked to today's economic situation. But the good news is that it's managing a key element: what it has to sell to shoppers. And it's making sure that during these troubled times, it's offering them what they need and can afford.

Target also continues to prepare for better days by working on the efficiency of replenishing inventory, and it's investing in its stores. The company says it plans to put as much as $5 billion into growth initiatives this year.

Now, let's take a look at Target's valuation. Today, the retailer trades for less than 20 times forward earnings estimates -- less than half of its level a year ago.

This looks cheap considering the improvements in Target's inventory and cash flow -- and its gains in traffic. This shows that it is managing today's tough conditions, and that shoppers keep coming back to the retailer. So if investors hold on for a while longer, they -- and Target -- may truly reap the rewards.