Stocks declined on Thursday, led by losses in the Nasdaq as investors took profits after recent sharp gains.

A higher profit outlook from Wal-Mart Stores Inc limited losses in the Dow and S&P 500.

Apple Inc, which had been higher earlier in the session after receiving a price target increase from Goldman Sachs, erased gains to become the top drag on both the Nasdaq and the S&P 500 index.

There may be some profit-taking in some of the names that have done well, said Owen Fitzpatrick, head of the U.S. equity group at Deutsche Bank Private Wealth Management, in New York. A lot of these names over the last couple of days have had pretty tremendous runs.

Apple was among stocks that led the Nasdaq's recent run higher.

Shares of Wal-Mart, which notched their biggest advance in four months, rose 3.5 percent to $47.19 on the New York Stock Exchange.

The outlook from Wal-Mart, the world's largest retailer, overshadowed disappointing September sales from other retailers, including Target Corp and J.C. Penney Co Inc.

The Dow Jones industrial average was down 16.02 points, or 0.12 percent, at 14,062.67. The Standard & Poor's 500 Index was down 2.65 points, or 0.17 percent, at 1,559.82. The Nasdaq Composite Index was down 26.31 points, or 0.94 percent, at 2,785.30.

Shares of Apple were down 2.6 percent at $162.45.