The major domestic equity indexes were well into positive territory at the closing bell on Friday, led by gains in consumer stocks, even as a possible government shutdown loomed.

The S&P 500 and the Nasdaq hit record closing highs, while the Dow Jones Industrial Average ended the day higher after trading in a narrow range.

Nike, Philip Morris and Home Depot rose between 1.5 percent and 4.8 percent on upbeat analyst expectations, helping to send the S&P 500 higher. Conversely, losses in IBM and American Express capped gains on the Dow.

A disappointing full-year profit forecast from IBM pushed its shares down 4.0 percent, the biggest single-day loss since July. American Express slipped 1.8 percent after posting its first quarterly loss in 26 years and suspending share buybacks for the next six months.

For the week, the Dow rose 1.04 percent, the S&P 500 added 0.86 percent and the Nasdaq gained 1.04 percent.

Nine of the 11 major S&P sectors were higher, led by a 1.1 percent gain in the consumer staples index and a 0.9 percent rise in consumer discretionary stocks.

The Senate spent the day trying to avert a shutdown ahead of a midnight deadline on the spending measure amid lingering disagreements between Democrats and Republicans. Negotiations continued on Friday after Senate Democratic leader Chuck Schumer met with President Donald Trump at the White House to address the impasse.

Approximately 6.82 billion shares changed hands on the major domestic equity exchanges, as compared to the 6.32 billion share average over the past 20 trading days.