U.S. stocks closed lower Thursday, capping the worst year for the market since 2008.

The Standard & Poor’s 500 index ended essentially flat for the year after the day’s modest losses nudged it into the red for 2015. Even factoring in dividends, the index eked out a far smaller return than in 2014.

The Dow Jones industrial average also closed out the year with a loss. The tech-heavy Nasdaq composite fared better, delivering a gain for the year.

“It’s a lousy end to a pretty lousy year,” said Edward Campbell, portfolio manager for QMA, a unit of Prudential Investment Management. “A very unrewarding year.”

The Dow ended the day down 178.84 points, or 1.02 percent, to 17,425.03. The S&P 500 index lost 19.42 points, or 0.9 percent, to 2,043.94. The Nasdaq composite fell 58.44 points, or 1.2 percent, to 5,007.41.

For 2015, the Dow registered a loss of 2.2 percent. It’s the first down year for the Dow since 2008. The Nasdaq ended with a gain of 5.7 percent.

The S&P 500 index, regarded as a benchmark for the broader stock market, lost 0.7 percent for the year. According to preliminary calculations, the index had a total return for the year of just 1.4 percent, including dividends. That’s the worst return since 2008 and down sharply from the 13.7 percent it returned in 2014.

While U.S. employers added jobs at a solid pace in 2015 and consumer confidence improved, several factors weighed on stocks in 2015. Investors worried about flat earnings growth, a deep slump in oil prices and the impact of the stronger dollar on revenues in markets outside the U.S. They also fretted about the timing of the Federal Reserve’s first interest rate hike in more than a decade.

Crude oil recovered some of its losses from the day before. Benchmark U.S. crude climbed 44 cents to close at $37.04 a barrel in New York. Brent crude, used to price international oils, gained 82 cents to close at $37.28 a barrel in London.