Wall Street had climbed on Wednesday, boosted by energy shares and helped by news of an agreement to extend the debt limit, as stocks bounced back from a day-earlier selloff.
US stocks built on moderate gains after news that President Donald Trump, siding with Democrats over his fellow Republicans, said he agreed to pass an extension of the US debt limit until December 15, potentially avoiding an unprecedented default on US government debt.
Data showed US services sector activity accelerated in August amid strong gains in new orders and employment, while another report showed only a modest rise in the trade deficit in July - the latest signs that the economy had gathered momentum early in the third quarter.
A Federal Reserve survey showed the US economy expanded at a modest to moderate pace in July through mid-August.
The S&P 500 on Tuesday had suffered its biggest single-day decline in nearly three weeks amid fresh tensions involving North Korea and a second powerful hurricane bearing down on the US south.
“You have opposing forces kind of keeping the market from breaking out to a new high, but yet the fundamental data seem to be keeping it from breaking down and selling off significantly," said Walter Todd, chief investment officer of Greenwood Capital in Greenwood, South Carolina.
“You kind of have these opposing forces pushing on each other and keeping the market in a very narrow range,” Todd said.
The Dow Jones Industrial Average rose 54.33 points, or 0.25 per cent, to 21,807.64, the S&P 500 gained 7.69 points, or 0.31 per cent, to 2,465.54 and the Nasdaq Composite added 17.74 points, or 0.28 per cent, to 6,393.31.
Despite Tuesday's fall, the benchmark S&P 500 had ended on Wednesday within 15 points of its record closing high.
The natural trend in the market is to run scared at the first sign of trouble and then to bounce back,” said Brad McMillan, chief investment officer for Commonwealth Financial Network in Waltham, Massachusetts. “Once investors had a chance to digest some of the events, they realized that from a domestic point of view, it simply isnt that bad.”
The energy sector rose 1.6 per cent, for its biggest single-day gain in two months, as oil prices rose. Strong global refining margins and the reopening of US Gulf Coast refineries provided a more bullish outlook after sharp drops due to Hurricane Harvey.
Two-percent gains for shares of oil majors Exxon Mobil and Chevron supported the S&P 500 and the Dow.
Financials climbed 0.2 per cent a day after their largest one-day drop since mid May. Nine of 11 major sectors finished in positive territory.
Investors were digesting news that Fed Vice Chair Stanley Fischer said he would step down from his position in mid-October, potentially accelerating Trump's opportunity to reshape the direction of the central bank.
AT&T shares fell 1.4 per cent and Verizon slid 1.0 per cent, dragging on the S&P. Rival T-Mobile US said it will offer a free subscription to video streaming service Netflix with its unlimited data family plans.
Advancing issues outnumbered declining ones on the NYSE by a 1.65-to-1 ratio; on Nasdaq, a 1.27-to-1 ratio favoured advancers. About 6.3 billion shares changed hands in US exchanges, above the 5.8 billion daily average over the last 20 sessions.