NEW YORK (Reuters) - Wall Street rose 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 ended the day higher after trading in a narrow range.

Nike Inc NKE.N, Philip Morris International Inc PM.N and Home Depot Inc HD.N rose between 1.5 percent and 4.8 percent on upbeat analyst expectations, helping to boost the S&P 500. Conversely, losses in International Business Machines Corp IBM.N and American Express AXP.N capped gains on the Dow.

The Dow Jones Industrial Average .DJI rose 53.91 points, or 0.21 percent, to close at 26,071.72, the S&P 500 .SPX gained 12.27 points, or 0.44 percent, to 2,810.3 and the Nasdaq Composite .IXIC added 40.33 points, or 0.55 percent, to 7,336.38.

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 .SPLRCS and a 0.9 percent rise in consumer discretionary stocks .SPLRCD.

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.

“The market has a few jitters as the result of a potential shutdown,” said Kevin Miller, chief executive of E-Valuator Funds in Bloomington, Minnesota. “From a longer-term perspective, corporate earnings are still strong, and we’re about to engage in the benefits of tax reform.”

The U.S. Senate was racing 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.

Advancing issues outnumbered declining ones on the NYSE by a 1.98-to-1 ratio; on Nasdaq, a 2.51-to-1 ratio favored advancers.

The S&P 500 posted 105 new 52-week highs and nine new lows; the Nasdaq Composite recorded 171 new highs and 30 new lows.

Volume on U.S. exchanges was 6.82 billion shares, compared to the 6.32 billion average over the last 20 trading days.