NEW YORK — U.S. stocks set more records in quiet post-holiday trading Friday as technology companies again did much of the heavy lifting. Energy companies rose with the price of oil.

Macy’s and some of its retail counterparts rose after the department store’s CEO said Black Friday sales were going well. Online titan Amazon made an even bigger gain. Oil prices and energy companies rose after Bloomberg reported that a group of key oil producers plans to extend production cuts until the end of 2018.

“If you take the cumulative effect of online and foot traffic going into the stores, it’s showing you a robust consumer spending pattern,” said Quincy Krosby, chief market strategist at Prudential Financial.

The Standard & Poor’s 500 index rose 5.34 points, or 0.2 percent, to 2,602.42, its first close above 2,600.

The Dow Jones industrial average added 31.81 points, or 0.1 percent, to 23,557.99. The Nasdaq composite gained 21.80 points, or 0.3 percent, to 6,889.16. The Russell 2000 index of smaller companies climbed 2.40 points, or 0.2 percent, to 1,519.16.

The Dow finished slightly below its record high from Tuesday but the other major indexes closed at all-time highs. Trading ended early in honor of the Thanksgiving holiday.

Macy’s CEO Jeffrey Gennette told CNBC holiday shopping is off to a good start with relatively few discounts and strong sales of some especially profitable products like winter clothing. Macy’s gained 44 cents, or 2.1 percent, to $21.07 and other department stores climbed as well.

Experts are mostly predicting strong sales over the holiday shopping period because of increased consumer confidence and a very low unemployment rate. The National Retail Federation trade group expects sales to grow at least as fast as they did last year.

Big retailers like Walmart and Urban Outfitters and Gap have also reported strong quarterly results recently. On Friday, Gap added 47 cents, or 1.6 percent, to $29.64 and electronics retailer Best Buy gained 51 cents to $57. Amazon’s stock rose $29.84, or 2.6 percent, to $1,186.

Amazon, along with tech giants Apple, Facebook, Microsoft and Google’s parent company Alphabet, have played a huge role in the market’s gains this year. Those five companies combined are responsible for more than one-fourth of the value the S&P 500 has gained this year. Amazon and Facebook closed at all-time highs Friday.

U.S. benchmark crude rose 93 cents, or 1.6 percent, to $58.95 a barrel in New York. Krosby said the Keystone oil pipeline spill earlier this month has also pushed U.S. oil prices higher by disrupting supplies.

Brent crude, used to price international oils, added 31 cents to $63.86 a barrel in London. Hess gained 95 cents, or 2.2 percent, to $44.40 and Marathon Oil added 25 cents, or 1.7 percent, to $15.13.

In other energy trading, wholesale gasoline added 2 cents to $1.79 a gallon. Heating oil rose 2 cents to $1.95 a gallon. Natural gas sank 16 cents, or 5.2 percent, to $2.81.

The dollar rose to 111.58 yen from 111.23 yen. The euro climbed to $1.1927 from $1.1853.