Good news from J.C. Penney helped offset disappointing earnings reports from some U.S. companies.
Merck fell after the drugmaker sharply lowered its profit forecast and reported a plunge in third-quarter earnings.
The S&P 500 rose two points, or 0.1 percent, to 1,762. It also closed at record highs last Tuesday and Friday.
The Dow Jones industrial average slipped a point to 15,568.
The Nasdaq composite fell three points, or 0.1 percent, to 3,940.
Homebuilders fell after the number of Americans who signed contracts to buy previously occupied homes fell in September to the lowest in nine months, reflecting higher mortgage rates and home prices.