U.S. stocks closed slightly lower Thursday, pulled down by a slide in technology and consumer companies.

The losses offset a rally in energy stocks sparked by a report indicating fuel stockpiles fell precipitously last week. The price of oil jumped almost 5 percent.

On Thursday:

The Dow Jones industrial average lost 46.23 points, or 0.3 percent, to 18,479.91.

The Standard & Poor’s 500 index dipped 4.86 points, or 0.2 percent, to 2,181.30.

The Nasdaq composite fell 24.44 points, or 0.5 percent, to 5,259.48.

For the week:

The Dow is down 12.05 points, or 0.1 percent.

The S&P 500 is up 1.32 points, or 0.1 percent.

The Nasdaq is up 9.58 points, or 0.2 percent.

For the year:

The Dow is up 1,054.88 points, or 6.1 percent.

The S&P 500 is up 137.36 points, or 6.7 percent.

The Nasdaq is up 252.07 points, or 5 percent.