The major U.S. stock indexes finished mostly higher Friday after a broad rally faded in the last minutes of trading as Wall Street closed out the final day of the second quarter.

Industrial stocks led the gainers. Consumer-focused companies also rose. Utilities, technology and health care companies were among the stocks that finished with modest losses.

On Friday:

The Standard & Poor’s 500 index rose 3.71 points, or 0.2 percent, to 2,423.41.

The Dow Jones industrial average gained 62.60 points, or 0.3 percent, to 21,349.63.

The Nasdaq composite lost 3.93 points, or 0.1 percent, to 6,140.42.

The Russell 2000 index of smaller company stocks gave up 0.84 points, or 0.1 percent, to 1,415.36.

For the week:

The S&P 500 is down 14.89 points, or 0.6 percent.

The Dow is down 45.13 points, or 0.2 percent.

The Nasdaq is down 124.83 points, or 2 percent.

The Russell 2000 is up 0.58 points, or 0.04 percent.

For the year:

The S&P 500 is up 184.58 points, or 8.2 percent.

The Dow is up 1,587.03 points, or 8 percent.

The Nasdaq is up 757.30 points, or 14.1 percent.

The Russell 2000 is up 58.23 points, or 4.3 percent.