Analysts said that investors focused in on these sectors and others that have been weak lately and snapped up some bargains.
The Dow Jones industrial average gained 78.50 points to close at 7,079.39, an all-time high, beating the previous record of 7,067.46 set on Feb. 18.
Advancing issues led decliners on the New York Stock Exchange by a margin of nearly 2-to-1.
Volume was 458.75 million, down from 505.84 million on Friday.
Also advancing to a record high was the NYSE composite index, which rose 3.87 to 427.70, besting the Feb. 18 record of 427.07.
The Standard & Poor's 500-stock index gained 8.68 to 813.65. The Nasdaq composite climbed 10.92 to 1,322.72 and the American Stock Exchange index rose 1.57 to 603.63.
Edward Collins, head of stock trading at Daiwa Securities America, said the market has been quickly shifting its focus among business sectors.
"There are no real reasons, but it seems like we've been in a rolling rotation and this is pretty healthy for the markets. It's not necessarily monthly or quarterly, but sometimes on a weekly basis or less and if you're smart enough to know which one is going to be next you'll make some money," he said.
Oil refiners and equipment makers also rallied.
Although this is traditionally a season of weaker prices as the market shifts from heating fuels to gasoline, crude oil remains above $20 a barrel.