Gains by energy and Internet companies helped drive stocks broadly higher Thursday, snapping a two-day losing streak in an otherwise choppy week of trading.
The gains were initially fueled by rising oil prices, which boosted energy companies following a suspected attack on two oil tankers in the strategic Strait of Hormuz. The sector sustained its gains as a mix of media, Internet, and consumer-oriented companies took the lead in pushing every major index higher. Small-company stocks rose more than the rest of the market.
Investors have been searching for direction as they cautiously await developments in the US-China trade. Any escalation could crimp global economic growth and put the brakes on what is poised to be the longest economic expansion in US. history.
Anticipation of next week’s Federal Reserve meeting helped lift the market Thursday, said Jeff Zipper, managing director at US Bank Private Wealth Management.
‘‘You’ve got two competing forces here right now,’’ Zipper said. ‘‘The lingering issue of when is this trade tariff deal going to get resolved, and a more dovish Fed.’’
Last week, Fed chair Jerome Powell set off a market rally after he signaled the central bank is willing to cut interest rates to help stabilize the economy if the trade war starts to crimp growth.
The S&P 500 index rose 11.80 points, or 0.4 percent, to 2,891.64. The benchmark has been seesawing this week, opening strong on Monday and then falling for two days before reversing course again Thursday. The uneven week follows the index’s best week of 2019.
The Dow Jones industrial average gained 101.94 points, or 0.4 percent, to 26,106.77. The Nasdaq added 44.41 points, or 0.6 percent, to 7,837.13. The Russell 2000 index of small company stocks climbed 16.01 points, or 1.1 percent, to 1,535.80.
Bond prices rose. The yield on the 10-year Treasury note fell to 2.10 percent from 2.12 percent late Wednesday.
US stock indexes rebounded early Thursday as oil prices surged on news of a suspected attack on two tankers in the Strait of Hormuz, amid heightened tension between the United States and Iran. One third of all oil traded by sea, which amounts to 20 percent of oil traded worldwide, passes through the strait. The United States blamed Iran in what it called a campaign of ‘‘escalating tensions’’ in a region crucial to global energy supplies.
Benchmark US crude rose 2.2 percent to settle at $52.28 a barrel. Brent crude, the international standard, added 2.2 percent to $61.31. The gains come at a time when oil prices have been falling on signs demand is declining.
Analysts questioned whether the gains can hold. Jim Ritterbusch of Ritterbusch & Associates said in a note to clients the jump is factoring in a worst-case scenario and oil is ‘‘apt to relinquish the bulk of gains as additional details emerge.’’
In addition, OPEC added to the recent concerns among traders that global demand is slipping. In its latest monthly report, OPEC forecast demand would grow by 1.4 million barrels a day in 2019, down by 700,000 barrels a day from its previous forecast. OPEC said it lowered the forecast due to ‘‘sluggish oil demand data’’ from Western countries during the first quarter. While global demand appears to be slipping, supplies remain high.
The surge in oil prices lifted shares of oil services companies and oil producers. Schlumberger gained 3.4 percent.
Walt Disney gained 4.4 percent, leading a mix of media and Internet companies higher. Shares in Google parent Alphabet rose 1.1 percent, and Facebook gained 1.4 percent.
Tapestry’s 3.9 percent gain led consumer stocks higher, including Macy’s, Home Depot, and Lowe’s. Those companies caught an extra boost from the latest mortgage rate figures, which remain near historic lows.
Mortgage buyer Freddie Mac says the average rate on the 30-year, fixed-rate mortgage held steady from last week at 3.82 percent, its lowest point since September 2017. Lennar and KB Home each rose 1.9 percent.
Lululemon gained 2.1 percent after stretching beyond Wall Street’s profit and revenue forecasts for the first quarter. The maker of athletic apparel also raised its profit forecast.
Furniture and housewares retailer RH surged 15.8 percent after it blew past Wall Street’s quarterly profit forecasts and raised its own forecast for the year. The company said it raised some prices to offset the impact of tariffs and plans to move some production out of China.
Higher fares gave major airlines a boost. American Airlines’ stock surged 6.4 percent, Delta gained 1.9 percent, and Southwest rose 3.1 percent.
Health care stocks lagged the market.