The Dow Jones Industrial Average advanced for the first time this week, as investors shrugged off the sharpest US economic contraction since 2009.
The Dow added 49.38 points, or 0.3%, to close at 16867.51, near the session's highs. The S&P 500 climbed 9.55 points, or 0.5%, to 1959.53, while the Nasdaq Composite Index rose 29.40 points, or 0.7%, to 4379.76.
Stocks had initially wavered after the final reading on first-quarter US gross domestic product came in worse than expected, showing a 2.9% contraction versus a previous estimate of a 1% decrease. A separate reading showed orders for durable goods in May declined 1%, compared with expectations they would remain flat.
Market watchers said it was difficult to pin down a specific reason for the gains, but most agreed the GDP number, though worse than forecast, had already been factored into stock prices through two previous estimates. And so far, more recent second-quarter data point to an economy that has improved as warm weather helped drive consumers and open work sites.
"The GDP print is backward-looking," said Yousef Abbasi, market strategist at brokerage JonesTrading Institutional Services. "People feel a lot better about [the second quarter]."
Mr Abbasi called trading volumes on Wednesday "flattish and unimpressive," suggesting little conviction from either buyers or sellers.
Oil refiners Valero Energy and Marathon Petroleum were the biggest decliners on the S&P 500 after The Wall Street Journal reported the US is poised to export oil for the first time in nearly 40 years. Traders said that refiners' earnings could come under pressure should US exports narrow the prices between US and international crude benchmarks. The Journal reported that Pioneer Natural Resources and Enterprise Products Partners obtained permission to export oil, sending both stocks higher.
Broadcasters' stocks including CBS, Comcast and Walt Disney rose after the Supreme Court ruled that Aereo, an online-video service, violated copyright law.
Despite Wednesday's gains, some investors voiced caution.
Uri Landesman, president of New York's Platinum Partners, which oversees about $US1.4 billion, said he expects most US stock prices to be lower three months from now. "There is a tremendous amount of momentum in the market," he said. "But I don't think it's going to take much to spook this market: the longer you stretch it out, the more likely [a pullback] is to happen."
The steady, two-month climb for stocks was briefly interrupted by slim losses on Monday, then a 119-point slump for the Dow on Tuesday, its biggest decline since May 20. Traders pointed to increasing willingness to cash out of winning positions as a contributing factor for the pause. The S&P 500 has gained 4.7% since the start of April.
Others are wary of escalating violence overseas. A Barclays survey published Tuesday showed that the majority of investors are most concerned about the impact of geopolitical unrest on markets.
But investors including Robert Glownia, quantitative analyst at RiverFront Investment Group, aren't yet cashing out of US stocks on the view that the US economy is slowly improving.
"We're still bullish on stocks," Mr Glownia said, noting that his firm has recently added energy shares. "We might get some kind of a correction, but even in light of geopolitical news, it's bullish that the S&P 500 has hung in."
The dollar slumped against the euro and yen after the GDP release, while yields on benchmark 10-year Treasury notes slipped to 2.559%, down from 2.586% late on Tuesday.
Overseas markets were lower following Tuesday's declines on Wall Street. The Stoxx Europe 600 fell 1.1%, while Japan's Nikkei fell 0.7%. Shares in Dubai rose after a three-day rout, with the benchmark DFM index rising 6.1%.
Crude-oil futures edged up 0.4% to settle at $US106.50 a barrel, while gold futures gained 0.1% to settle $US1,322.20 a troy ounce.
General Mills slipped 3.6% after the company missed analysts' quarterly earnings estimates and unveiled a round of cost-cutting measures.
Monsanto rose 5.1% after the company topped estimates and authorized a $US10 billion share-buyback program.
Barnes & Noble jumped 5.3% after the company said it would pursue a split of its retail and Nook e-reader businesses into two separate public companies by early next year.
Hanesbrands gained 9.2% after reaching a deal to expand into Europe by acquiring French underwear maker DBApparel from Sun Capital Partners.
Lindsay, which makes irrigation systems, slumped 4.8% as turmoil in Iraq and Ukraine complicated contracts to operate in those countries.