US stocks rose on Thursday after two days of declines, as energy shares rebounded with oil on concerns of a supply disruption following attacks on two tankers in the Gulf of Oman.
US Secretary of State Mike Pompeo said the United States has assessed that Iran is responsible for the attacks, which occurred near Iran and the Strait of Hormuz, through which a fifth of global oil consumption passes.
Oil futures settled more than 2 percent higher, while the S&P 500 energy index gained 1.3 percent, the most of the 11 major sectors.
"We're meandering here with strength in the oil sector because that's where the market-moving news is today," said Bucky Hellwig, senior vice president at BB&T Wealth Management in Birmingham, Alabama.
While the gains in energy shares helped the market, the tanker attacks added to potential worries for investors.
"There are still concerns over geopolitical risk," said Quincy Krosby, chief market strategist at Prudential Financial in Newark, New Jersey.
Stocks have had a strong run in June so far on hopes the Federal Reserve will act to counter a slowing global economy due to the escalating trade war with China. The benchmark S&P 500 index is up about 5% so far for the month.
But caution ahead of the Fed meeting next week and the Group of 20 summit at the end of the month limited the day's advance. Markets have been anticipating an interest rate cut at some point this year.
"The market is waiting to hear from the Fed... and whether they will deviate at all from their latest stance - and I call it an active dovish position - and to see if they continue to lay the groundwork for a rate cut perhaps later in the summer," Krosby said.
The Dow Jones Industrial Average rose 101.94 points, or 0.39 percent, to 26,106.77, the S&P 500 gained 11.8 points, or 0.41 percent, to 2,891.64 and the Nasdaq Composite added 44.41 points, or 0.57 percent, to 7,837.13.
Walt Disney Co shares gained 4.4 percent, giving the S&P 500 its biggest boost, after Morgan Stanley raised its forecast for Disney Plus subscriber growth.
On the trade front, there were doubts of any improvement in what President Donald Trump called "testy" trade relations with China in the run-up to the G20.
Several companies including furniture chain RH cited the potential impact of higher tariffs on their businesses in reports after the bell Wednesday, though RH said it has taken steps to mitigate the impact of tariffs and raised its outlook for the year.
Twitter Inc shares fell 3.1 percent after brokerage Moffett Nathanson said it expects the social media company's costs to rise and revenue growth to slow.
Advancing issues outnumbered declining ones on the NYSE by a 2.66-to-1 ratio; on Nasdaq, a 2.23-to-1 ratio favoured advancers.
The S&P 500 posted 31 new 52-week highs and one new low; the Nasdaq Composite recorded 58 new highs and 64 new lows.
Volume on US exchanges was 5.99 billion shares, compared to the 6.87 billion average for the full session over the last 20 trading days.