Buying in technology and financials pushed stocks higher, outweighing declines in the energy sector.
The Dow Jones Industrial Average, the Nasdaq and S&P 500 all finished higher. Investors put fresh money to work in technology as selling in commodities-related stocks eased. Oil prices closed at their lowest level in 19 months.
A rally in shares of Apple , in particular, encouraged investors to bet that technology stocks will lead gains this year.
With Tuesday's debut of Apple's new iPhone still in the spotlight, the company's shares rose to a record high, boosting both the Nasdaq and S&P 500. Several brokerages raised their price targets on the stock a day after Apple introduced the new media-playing cell phone.
"The standout has been technology and people seem to feel more secure about that," Art Cashin, Director of Floor Operations for UBS, told CNBC. "All the hoopla around the iPhone certainly got everyone's attention and they're hoping that Microsoft's new product will begin to maybe sell some PCs."
Information technology was the best performing S&P sector, rising 0.7%. Energy was the worst performer, down 1.6%. The financial sector posted a late afternoon rally with shares of Goldman Sachs and Merrill Lynch rising.
Chip stocks gained with Texas Instruments and Dow component Intel moving higher.
On Thursday, investors will examine more corporate earnings reports, as well as weekly jobless claims and the weekly natural gas inventory report.
New York light crude futures closed lower at $54.02 a barrel, the lowest level in 19 months and beneath $55 a barrel, a key technical support level, according to traders.
The decline in oil drove energy stocks lower. Shares of big oil companies including Conoco Phillips and Chevron were lower. Chevron said late Tuesday that oil and gas production fell in the fourth quarter and that results would be hurt by lower commodities prices. Refining companies were also under pressure including Valero Energy.
Shares of Alcoa were higher after the Dow component kicked off earnings reporting a 60% rise in fourth-quarter profit.
Shares of Venezuelan telecommunications company CANTV rose sharply on reports that the government would pay compensation to companies affected by President Hugo Chavez's plans to nationalize the telecom and energy industries.
The U.S. trade deficit narrowed in November to $58.2 billion. Economists had expected the trade gap to widen slightly from October. Treasury prices were down slightly, sending yields higher.
Europe Closes Lower
London's FTSE 100, Frankfurt's DAX and the Paris CAC-40 all finished lower.
Shares of handset maker Nokia fell 2.2% after Apple Computer unveiled its iPhone on Tuesday. While shares of Apple jumped in the U.S., shares of smart-phone companies like BlackBerry maker Research In Motion and Palm were down sharply.
In Germany, Volkswagen fell 1.8%. Porsche CEO Wendelin Wiedeking, who controls two seats on VW's board, said he expects big changes at VW to improve results, The Wall Street Journal reported.