The major U.S. stock indexes closed slightly higher Tuesday, eking out enough of a gain to set more record highs.

Banks, insurers and other financial companies led the gainers. Technology stocks also helped lift the market, while health care companies lagged the most.

On Tuesday:

The Standard & Poor’s 500 index climbed 2.78 points, or 0.1 percent, to 2,506.65.

The Dow Jones industrial average rose 39.45 points, or 0.2 percent, to 22,370.80.

The Nasdaq composite added 6.68 points, or 0.1 percent, to 6,461.32.

The Russell 2000 index of smaller-company stocks slipped 0.68 points, or 0.1 percent, to 1,440.40.

For the week:

The S&P 500 is up 6.42 points, or 0.3 percent.

The Dow is up 102.46 points, or 0.5 percent.

The Nasdaq is up 12.85 points, or 0.2 percent.

The Russell 2000 is up 8.69 points, or 0.6 percent.

For the year:

The S&P 500 is up 267.82 points, or 12 percent.

The Dow is up 2,608.20 points, or 13.2 percent.

The Nasdaq is up 1,078.21 points, or 20 percent.

The Russell 2000 is up 83.27 points, or 6.1 percent.