NEW YORK — U.S. stocks staged a late recovery Thursday and finished mostly higher, led by technology and metals companies. Energy companies continued to fall with the price of oil.

On Thursday:

The Dow Jones industrial average added 18.42 points, or 0.1 percent, to 18,419.30.

The Standard & Poor’s 500 index dipped 0.09 points to 2,170.86.

The Nasdaq composite picked up 13.99 points, or 0.3 percent, to 5,227.21.

For the week:

The Dow is up 23.90 points, or 0.1 percent.

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

The Nasdaq is up 8.29 points, or 0.2 percent.

For the year:

The Dow is up 994.27 points, or 5.7 percent.

The S&P 500 is up 126.92 points, or 6.2 percent.

The Nasdaq is up 219.80 points, or 4.4 percent.