Gains in energy and chemical companies nudged the stock market higher Thursday. Facebook soared 30 percent after reporting earnings that easily beat analysts' forecasts.

The Dow Jones industrial average rose 13.37 points, or 0.09 percent, to close at 15,555.61.

The Standard & Poor's 500 index gained 4.31 points, or 0.3 percent, to 1,690.25.

The Nasdaq composite index gained 25.59 points, or 0.7 percent, to 3,605.19.

For the week:

The Dow is up 11.87 points, or 0.1 percent.

The S&P 500 is down 1.84 points, or 0.4 percent.

The Nasdaq is up 17.58 points, or 0.5 percent.

For the year so far:

The Dow is up 2,451.47 points, or 18.7 percent.

The S&P 500 is up 264.06 points, or 18.5 percent.

The Nasdaq is up 585.68 points, or 19.4 percent