Technology stocks powered much of the rally as investors focused on the latest batch of mostly solid company earnings reports. The latest gains came as worries about the economic impact of the virus outbreak that originated in China continued to subside.
Health officials raised hopes that the spread of the virus is peaking after new cases dropped for a second straight day. Worries about the economic impact of the outbreak fueled a wave of selling that erased the market's gains in January, but traders have since largely set aside their jitters.
The S&P 500 index is up 4.8% so far this month, on pace for its biggest monthly gain since June.
"You have the continuing good news on the coronavirus potentially slowing and being under control, and that's obviously powerful," said Tom Martin, senior portfolio manager with Globalt Investments.
The S&P 500 index rose 21.70 points, or 0.6%, to 3,379.45. The Nasdaq climbed 87.02 points, or 0.9%, to 9,725.96. Both indexes have set all-time closing highs every day this week.
The Dow Jones Industrial Average gained 275.08 points, or 0.9%, to 29,551.42. The Russell 2000 index of smaller company stocks picked up 11.86 points, or 0.7%, to 1,689.38.
Major indexes in Europe and Asia finished higher.
Bond prices fell. The yield on the 10-year Treasury rose to 1.63% from 1.59% late Tuesday.
Stronger-than-expected company earnings reports and positive U.S. economic data have helped keep investors in a buying mood. Traders are also banking that central banks and governments around the world will support markets with rate cuts and stimulus to stem any potential economic fallout from the virus outbreak.
Investors got some encouraging news Wednesday when health officials reported that the number of new cases of the coronavirus in China declined for a second straight day. The outbreak has infected over 45,000 people worldwide and killed more than 1,100.
Meanwhile, Chinese President Xi Jinping promised tax cuts and other aid to industry as the ruling Communist Party tries to limit the mounting damage to the economy.
Shares in companies focusing on travel made some of the strongest gains Wednesday. United Airlines rose 2.1%, Wynn Resorts climbed 3.7% and Royal Caribbean Cruises gained 3.7%.
Cruise lines, hotels and other companies have been more sensitive than other companies to the spread of the virus.
Technology stocks led the broader market's gains. Micron Technology climbed 3.5% and Apple rose 2.4%.
Companies that rely on consumer spending also did well. Nike gained 3% and Gap jumped 4.7%.
Communication services stocks notched solid gains. Twitter added 3.2% and video-game developer Activision Blizzard rose 2.6%.
Crude oil jumped 2.5%, which gave energy companies a boost. Hess led the gainers, climbing 4.7%. The energy sector remains the market's worst-performer this year. It's down 9.1%.
The pickup in bond yields weighed on several homebuilders, including Toll Brothers, which slid 1.6%. Mortgage rates tend to track the 10-year Treasury yield, so an increase in the yield means less attractive rates.
Utilities and household goods makers lagged the market in another sign that investors were more confident and shifting money into investments that carry more risk.
Investors continued to assess the latest company earnings reports.
Akamai Technologies rose 1.1% after the cloud services provider beat analysts' profit and revenue forecasts. Generic drug developer Teva jumped 9.1% and e-commerce company Shopify vaulted 7.8% after reporting solid financial results.
Ride-hailing service Lyft plunged 10.2%. Lyft stuck to a prediction that it won't turn a profit until the fourth quarter of 2021. Rival Uber said earlier this month that it would make money in the fourth quarter of this year.
Wall Street appeared to largely ignore the outcome of Tuesday's Democratic presidential primary in New Hampshire, which Bernie Sanders won, edging out moderate rival Pete Buttigieg.
Despite Sanders' surge, it's still not clear which of the Democratic candidates will win the nomination, Martin noted.
"The feeling has been that Sanders, if he did become the candidate, has a platform that would not appeal to the country as a whole, so that if he was the candidate, Trump would easily beat him," he said.
Sanders has energized young voters and liberals with his calls for a Medicare for All health care system and free college tuition, but moderates portray such policies as unrealistic and costly.
"As far as a more moderate candidate, those would be more competitive and that would be potentially a negative if you had a credible candidate that might make a national election between the Democrats and the Republicans competitive," Martin said.
Benchmark crude oil rose $1.23 to settle at $51.17 a barrel. Brent crude oil, the international standard, gained $1.78 to close at $55.79 a barrel. Wholesale gasoline rose 7 cents to $1.58 per gallon. Heating oil climbed 5 cents to $1.68 per gallon. Natural gas rose 5 cents to $1.84 per 1,000 cubic feet.
Gold rose $1.80 to $1,567.40 per ounce, silver fell 9 cents to $17.48 per ounce and copper rose 2 cents to $2.61 per pound.
The dollar rose to 110.08 Japanese yen from 109.76 yen on Tuesday. The euro weakened to $1.0867 from $1.0922..