Stock indexes flickered between tiny gains and losses throughout the day before they mounted a small rally over the last half hour of trading.

NEW YORK U.S. stocks hardly moved Tuesday as investors were slow to dip a toe back into the market, although energy companies did climb with the price of oil and natural gas. Banks and retailers took losses.

Stock indexes flickered between tiny gains and losses throughout the day before they mounted a small rally over the last half hour of trading. Energy companies rose the most, and companies that make drinks, packaged foods, and other household items also rose. Retailers and department stores slumped after Urban Outfitters warned of weak first-quarter sales and Ralph Lauren said it will close stores and cut jobs.

That came a day after car makers reported weak sales for March, which raised concerns about sales of other goods.

Eric Wiegand, senior portfolio manager at U.S. Bank's Private Client Reserve, said consumers are very confident in the economy according to surveys, but considering high levels of employment and hiring, they're not spending that much.

"We would like to see that confidence reflected in their actual consumption and that's been somewhat mixed," he said.

The Standard & Poor's 500 index picked up 1.32 points, or almost 0.1 percent, to 2,360.16. The Dow Jones industrial average rose 39.03 points, or 0.2 percent, to 20,689.24. The Nasdaq composite added 3.93 points, or 0.1 percent, to 5,898.61.

Slightly more stocks fell than rose on the New York Stock Exchange, and the Russell 2000 index, which contains smaller-company stocks, lost 1.49 points, or 0.1 percent, to 1,368.18.

This week investors will pore over reports on the U.S. economy, including the monthly jobs report on Friday. Trade agreements will be in focus as President Donald Trump and Chinese President Xi Jinping meet Thursday and Friday.

Ralph Lauren dropped $3.63, or 4.5 percent, to $77.73 after it said it will close stores and cut jobs in an effort to save money. The company will close its Fifth Avenue store in Manhattan less than three years after it opened. Urban Outfitters lost 7 cents, or 3.1 percent, to $22.49 after it said sales at older stores have fallen over the last two months.

Other retailers also lost ground. Department store Nordstrom fell $2.56, or 5.5 percent, to $43.92 and L Brands, the owner of Victoria's Secret, shed $2.03, or 4.4 percent, to $43.77. But their online nemesis Amazon gained $15.32, or 1.7 percent, to $906.83. Amazon stock is up 21 percent this year.

Handbag and accessories maker Kate Spade slumped after Reuters said the company will take more time to negotiate a possible sale. The report cited anonymous sources and said that if Kate Spade is sold to a buyer like Michael Kors or Coach, it will likely be for less than the company's recent valuation of $2.9 billion. Kate Spade sank $3.34, or 14.6 percent, to $19.46.

Benchmark U.S. crude rose 79 cents, or 1.6 percent, to $51.03 per barrel in New York. Brent crude, used to price international oils, added $1.05, or 2 percent, to $54.17 a barrel in London. Anadarko Petroleum added 92 cents, or 1.5 percent, to $62.71.

The price of natural gas jumped 4.6 percent to $3.27 per 1,000 cubic feet, and Southwestern Energy climbed 70 cents, or 8.9 percent, to $8.59 while Range Resources gained $1.19, or 4.2 percent, to $29.76. Wholesale gasoline rose 3 cents to $1.72 a gallon and heating oil added 3 cents to $1.59 a gallon.