A trader works in his booth on the floor of the New York Stock Exchange on Feb. 21. / Richard Drew, AP

by Adam Shell and Kim Hjelmgaard, USA TODAY

by Adam Shell and Kim Hjelmgaard, USA TODAY

Stocks closed lower Tuesday as the Standard & Poor's 500 index failed in its latest attempt to march further into record territory.

Trading was choppy all day as stocks bounced back and forth between gains and losses.

The S&P 500 fell 2.5 points, or 0.1% to close at 1,845.12. The Dow Jones industrial average dropped 27.5 points, or 0.2%, to 16,179.66. The Nasdaq composite index fell 5.4 points, or 0.1%, to 4,287.59.

The benchmark S&P index fell just short of setting a new record close the day before and has erased much of the 5.8% drop it suffered from its Jan. 15 high to its Feb. 3 low.

Home Depot topped analyst earnings per share estimates by 2 cents despite a slight drop in earnings from a year ago. However the market reacted favorable as the home-improvement retailer boosted its dividend by 21%. Shares rose 4% to $80.99.

Macy's also topped forecasts despite same-store sales rising just 1.4%, after being negatively impacted by a harsh winter that caused hundreds of store closings. The department store chain, which includes Bloomingdale's, also said sales at the start of the new fiscal year in February "remained sluggish," saying business didn't pick up until Valentine's Day. Shares gained 6% to $56.25.

In economic news, the Conference Board's index of consumer confidence fell to 78.1 in February from 80.7 the month before. That was below the 80.1 level economists polled by FactSet were expecting. The report is a closely watched indicator of how likely consumers are to spend money and keep the economy moving forward.

Home prices fell for the second consecutive month in December. Prices dropped 0.1% from November based on the Standard & Poor's/Case-Shiller 20-city index.

On Wall Street on Monday, the S&P 500 ended up 11.36 points, or 0.6%, to 1,847.61, closing just shy of its record high close of 1,848.38 on Jan. 15. The Dow rose 103.84 points, or 0.6%, to 16,207.14. The Nasdaq composite index gained 29.56, or 0.7%, to 4,292.97.

Benchmark U.S. oil for April delivery was down 84 cents to $101.98 in electronic trading on the New York Mercantile Exchange. The contract gained 62 cents on Monday to close at $102.82.