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."