NEW YORK — U.S. stocks inched a bit further into record territory Wednesday after teeter-tottering through the day. The Standard & Poor’s 500 index rose by just a sliver, but it was enough for a seventh straight gain.

The S&P 500 climbed 3.16 points, or 0.1 percent, to 2,537.74 after flipping between slight losses and gains through the day. The seven-day win streak is the index’s longest since a similar run in May.

The Dow Jones industrial average rose 19.97 points, or 0.1 percent, to 22,661.64, and the Nasdaq composite picked up 2.91, or less than 0.1 percent, to 6,534.63. All three indexes added to records set a day earlier.

A report from payroll processor ADP said that hiring by private employers weakened sharply last month, a setback for an economy that had been enjoying a generally strengthening job market. But economists and investors were expecting a low number because of the damage done by hurricanes Harvey and Irma, which it is hoped will be only temporary.

The government will release its more comprehensive jobs report Friday, and economists are forecasting a weaker number than a month earlier.

Other reports painted a more encouraging picture. One showed that the nation’s services companies expanded last month at their fastest rate in more than a decade. The report from the Institute for Supply Management followed one on Monday that showed U.S. manufacturing is also growing strongly.

“Things continue to be very solid, and the economic numbers continue to be very strong not only here but throughout the world, which is what’s driving this,” said Kirk Hartman, global chief investment officer for Wells Fargo Asset Management.

Mylan surged to the biggest gain in the S&P 500 after federal regulators approved its generic version of Teva’s Copaxone drug for multiple sclerosis. Mylan jumped $5.27, or 16.2 percent, to $37.80.

Utility stocks were also strong, and such stocks in the S&P 500 jumped 1.1 percent.

On the losing end was Office Depot, which plunged after it announced a $1 billion purchase of an IT services and products provider, while cutting its forecast for operating profit this year. Its stock fell 81 cents, or 17.6 percent, to $3.78.

Bond insurers were also weak after President Donald Trump suggested in an interview with Fox News that the federal government may “wipe out” Puerto Rico’s debt after its struggle to recover from Hurricane Maria.

MBIA fell 73 cents, or 8.4 percent, to $7.95, Ambac Financial Group lost 98 cents, or 5.5 percent, to $16.70 and Assured Guaranty dropped $1.11, or 2.9 percent, to $37.58.

In the bond market, Treasury yields held relatively steady even as speculation rose about who the next chair of the Federal Reserve will be after Janet Yellen’s term ends in February. Trump has said previously that he may consider Yellen for another term, but other names have been floated in media reports including Kevin Warsh, a former Fed board member.

Under Yellen and her predecessor, Ben Bernanke, the Federal Reserve has unleashed unprecedented amounts of stimulus for the economy in hopes of recovering from the Great Recession. The central bank is now slowly pulling back the aid, and investors wonder if the next Fed chair may be more aggressive about it, or “hawkish,” as Wall Street traders call it.

“I think it’s reasonable to expect that the next Fed [chair] will be more hawkish,” Hartman said. “To be fair, the Fed itself has signaled that it wants to be more hawkish. I am not a big believer that, in the near term, whoever gets the nod is going to do anything dramatic.”

The yield on the 10-year Treasury edged down to 2.32 percent from 2.33 percent late Tuesday, while the two-year yield dipped to 1.47 percent from 1.48 percent.

Benchmark U.S. crude fell 44 cents to settle at $49.98 per barrel, while Brent crude, the standard for international oil prices, fell 20 cents to $55.80 per barrel.

Natural gas rose 5 cents to settle at $2.94 per 1,000 cubic feet, heating oil rose 2 cents to $1.77 a gallon and wholesale gasoline rose 2 cents to $1.58 per gallon.

Gold rose $2.20 to settle at $1,276.80, silver fell 3 cents to $16.62 per ounce and copper was close to flat at $2.96 per pound.

The dollar rose to 112.98 Japanese yen from 112.90 yen late Tuesday. The euro rose to $1.1764 from $1.1752, and the British pound inched up to $1.3250 from $1.3247.

In overseas markets, France’s CAC 40 fell 0.1 percent, Germany’s DAX gained 0.5 percent and the FTSE 100 in London was close to flat. Japan’s Nikkei 225 added 0.1 percent, and the Hang Seng in Hong Kong climbed 0.7 percent.