Investors have become nervous about the retail sector due to a host of concerns. These include the impact of tariffs on consumer spending and a potential recession.

You can see the effect on stock prices. The S&P 500 Retail Composite has lost 1.8% this year through June 18. During this time, the S&P 500 index gained 1.7%.

That makes this a good time for investors with a long-range view to examine retail sector stocks. These two stocks head the list for those who can tune out the short-term noise.

Someone looking at a receipt in the store.

Image source: Getty Images.

1. Home Depot

Home Depot (HD 0.91%) generates the highest sales among home improvement retailers. Its nearly 2,350 stores produced about $160 billion in sales for the latest fiscal year, which ended on Feb. 2. Its nearest competitor, Lowe's, has roughly 1,750 stores that had about $84 billion in sales.

Home Depot's large size confers certain advantages. These include its ability to offer a wide breadth of products at attractive prices.

But its business is tied to the broad economy and housing market. People will put off major construction during difficult economic times.

With high prices for basic items making consumers cautious along with high interest rates dampening demand for projects, Home Depot's top-line growth has suffered. Fiscal first-quarter same-store sales (comps) fell 0.3% for the period ended on May 4. Management expects comps to gain a tepid 1% for the year.

The short-term sales picture doesn't look great, and tariffs add another level of uncertainty. However, people will return to buying homes, which they often remodel.

Similarly, existing homeowners will do major construction projects at some point out of necessity or desire. Once they do, it seems likely homeowners and contractors will shop and spend more at Home Depot.

The stock's price fell 1.9% over the last year through June 18, lagging the S&P 500 index's 9% gain. Home Depot's shares trade at a price-to-earnings (P/E) ratio of 24, about the same level as a year ago. However, that's lower than the S&P 500's 29 P/E multiple.

2. Target

Target (TGT 0.58%) has also seen sales affected by the same macroeconomic forces and tariff policies. These may affect short-term sales and costs even further. And the company's top line has also been hurt by boycotts following management's decision to pull back on diversity, equity, and inclusion initiatives.

The combination caused fiscal first-quarter comps to drop 3.8%. Lower traffic was responsible for 2.4 percentage points of that, and decreased spending accounted for the balance. The period ended May 3.

But management has taken steps, albeit delayed, to rectify the situation and alleviate the boycotts. This includes having discussions with various groups.

Between boycotts and economic uncertainty, it's not too surprising that management lowered its earnings expectations for the year. It currently projects adjusted earnings per share of $7 to $9, down from the $8.80 to $9.80 range management provided when Target reported fourth-quarter results. The company earned $8.86 a share in fiscal 2024.

Nonetheless, I'm not concerned about the larger economic forces hurting long-term performance. At some point, consumers will feel comfortable spending more money. When they do, they'll undoubtedly turn to Target for its differentiated and exclusive merchandise.

Patient investors can take advantage of the situation by purchasing the stock at an attractive valuation. Target's share price has dropped more than 33% in the last year. The stock's P/E has declined from 16 to 10 during this time.