The S&P 500 ended the week before the U.S. election with its longest losing streak since 1980.

U.S. stocks were up for much of Friday’s session, after October employment data signaled solid momentum in the labor market and biotechnology shares bounced back after a two-session slide. But caution prevailed, and a late-afternoon slump dragged the S&P 500 to its ninth consecutive decline.

Tightening polls in the presidential election have dragged down stocks and pushed Wall Street’s “fear gauge” to its longest-ever stretch of gains. Investors also are grappling with a possible rise in U.S. interest rates next month and a renewed fall in oil prices.

The S&P 500 fell 3.48 points, or 0.2%, to 2085.18 on Friday, putting its nine-session decline at 3.1%. The last time the S&P 500 index fell for nine days in a row was the period ended Dec. 11, 1980—when it lost 9.4%.

Related Video WSJ's Jon Hilsenrath analyzes the October jobs report, including whether the report sets the stage for an interest rate increase by the Federal Reserve in December. Photo: European Pressphoto Agency

The relatively slight decline of the current streak highlights that while investors are cautious, they aren’t rushing to the exits. Since 1928, there have been 295 days when the S&P 500 has lost more than it has in this streak in one session, according to S&P Dow Jones Indices.

But the election has unnerved many investors, causing them to either sit on the sidelines or move to products they perceive as less risky, such as gold or shorter-duration bonds, as polls have tightened between the candidates.

“There’s general market anxiety driven by the election,” said Megan Greene, chief economist at Manulife Asset Management. “In the past, we talked about bulls and bears. Now I think there’s a big group of investors who are just unsure.”

Nonfarm payrolls rose by a seasonally adjusted 161,000 in October from the prior month. Above, people wait in line at a jobs fair in Atlanta. Photo: Bob Andres/Atlanta Journal-Constitution via AP

The CBOE Volatility Index, or VIX, has risen in the past nine trading sessions to 22.5, above its 10-year average of around 21. The fear gauge is based on S&P 500 options prices. Investors who buy VIX futures contracts are making a bet that stock-price volatility will go up in the next 30 days.

Craig Hodges, portfolio manager at Hodges Capital Management, said his funds have added to their cash positions over the past couple of weeks in anticipation of stock-market swings.

“It’s happened, but it’s been more severe than even I looked for,” he said. He is preparing for even more volatility. “You could still see another 5% selloff if there were a surprise election result,” he added.

The price of gold has gained more than 3% over the past nine trading sessions, rising 0.1% Friday to $1,303.30 an ounce. Demand for haven debt sent the yield on the two-year Treasury note down to 0.796% from 0.84% on Oct. 24. Bond yields fall when prices rise.

Oil has come under pressure as well. U.S.-traded crude fell 1.3% to $44.07 a barrel on Friday, marking a six-day losing streak in which prices slid 11%.

On Friday, the Dow Jones Industrial Average lost 42.39 points, or 0.2%, to 17888.28 and the Nasdaq Composite fell 12.04, or 0.2%, to 5046.37.

The S&P 500 closed at its lowest level since June 29.

The last time the index fell for nine days in a row was the period that ended in late-1980, a time of high inflation that preceded a recession, when the Federal Reserve was raising interest rates toward 20%.

A prolonged period of declines isn’t necessarily indicative of how the index will perform going forward. In previous nine-day or longer stretches of losses, stocks were nearly as likely to end the next month higher as they were to fall, according to Birinyi Associates Inc.

As U.S. stocks have slumped, so have equities around the globe. The Stoxx Europe 600 is down 4.5% over the past nine sessions. Japan’s Nikkei Stock Average, pressured by a stronger yen, has lost 1.9%.

“At the moment, the markets are truly U.S.-centric,” said Alain Bokobza, head of global asset allocation at Société Générale.

Earlier Friday, the Labor Department said the U.S. added 161,000 jobs in October, slightly below expectations. Wage growth accelerated to its strongest pace since the recession.

Some analysts said solid labor data bolstered the case for the Fed to raise interest rates in December. Others, however, said that volatility around the U.S. presidential election could derail plans for a rate raise.

“If the election were to trigger market turbulence…the Fed would not add oil on the fire of market turbulence by raising rates,” said Mr. Bokobza.

—Aaron Kuriloff contributed to this article.

Write to Corrie Driebusch at corrie.driebusch@wsj.com and Riva Gold at riva.gold@wsj.com