Investors shrugged off the potential for a federal government shutdown on Friday, driving US stocks higher and setting new milestones for several of the indexes.

The Standard & Poor’s 500 index, Nasdaq composite and Russell 2000 index of smaller-company stocks finished at record highs as the market bounced back from modest losses a day earlier.

The S&P 500 has now posted a weekly gain in nine of the last 10 weeks.

Retailers, banks and consumer goods companies accounted for much of the latest gains. Energy stocks fell along with crude oil prices. Utilities also declined as bond yields edged up to their highest level in more than three years.

The S&P 500 index rose 12.27 points, or 0.4%, to 2,810.30. The Dow Jones industrial average gained 53.91 points, or 0.2%, to 26,071.72. The average hit a new high on Wednesday.

The Nasdaq added 40.33 points, or 0.6%, to 7,336.38. The Russell 2000 index of smaller-company stocks picked up 20.90 points, or 1.3%, to 1,597.63.

Bond prices fell. The yield on the 10-year Treasury rose to 2.66% from 2.63% late Thursday. That is the highest level since July 2014. The increase in yields weighed on bond-proxy stocks, such as utilities. Exelon declined 62 cents, or 1.6%, to $37.97.

Investors have driven stock indexes higher on optimism over the global economic outlook and corporate earnings, and the possibility of a federal government shutdown did not dim that enthusiasm Friday.

Investors bid up shares in clothing makers, restaurant chains, department stores and other consumer-focused companies. Toy maker Mattel led the pack, climbing 91 cents, or 6%, to 16.14 dollars.

They also drove up tobacco manufacturers, food and beverage makers, and other consumer products companies. Philip Morris International picked up 3.85 dollars, or 3.7%, to 108.92 dollars. Campbell Soup added 1.14 dollars, or 2.5%, to 47.39 dollars.

Banks and other financial stocks also rose. Synchrony Financial gained 1.17 dollars, or 3.1%, to 38.47 dollars.

Lowe’s rose 3.5% after the home-improvement supply retailer named three new directors. The stock added 3.59 dollars to 104.95 dollars.

Some big companies missed out on the broader market gains Friday.

IBM slumped 4% despite a solid fourth-quarter report. The technology and consulting company was the biggest decliner in the Dow. The stock slid 6.75 dollars to 162.37 dollars.

American Express fell 1.8% after the credit card issuer suspended its share buy-back programme for six months following a big one-time tax charge. The stock shed 1.83 dollars to 98.03 dollars.

The price of bitcoin edged up 1.4% to 11,413 dollars, according to the tracking site CoinDesk.

Bitcoin futures on the Cboe Futures Exchange declined 3.1% to settle at 11,400 dollars. The futures allow investors to make bets on the future price of the digital currency.