Stocks added to gains in the last hour of trading Wednesday after struggling to find direction much of the day.
The market has been bound in a trading range since May, with the S&P failing to break beyond 1,130. The bias, however, has tilted higher lately, with all major indexes in positive territory for the year.
The Dow Jones Industrial Average rose more than 50 points, led by Travelers, General Electric, and Kraft. United Technologies and Chevron fell.
The S&P 500 and the Nasdaq also advanced. The CBOE Volatility Index, widely considered the best gauge of in the market, rose above 22.
The Dow and S&P 500 snapped a four-day winning streak in the previous session with financial and industrial stocks leading the declines.
Among key S&P 500 sectors, utilities, energy, and materials fell, while health care and consumer staples rose.
"Every day that we go by without a disaster coming out of Europe and the financial services industry is a good day," said Paul Larson, equities strategist at Morningstar. "A lot of the breathless predictions of doom and gloom, are frankly not just coming to fruition and that’s a good thing."
Health care stocks were higher Wednesday, led by pharmaceutical distributors McKesson , AmerisourceBergen and Cardinal Health , after analyst reports that fortunes for the companies may be improving.
As a whole, health care should do well, as a number of stocks in the sector are "just plain cheap," said Larson at Morningstar.
"I think what may be going on there is the market has an oversized trepidation regarding the health care reform," Larson said. "Meanwhile, you have a fairly large number of stocks and companies that are positioned exceptionally well, with strong franchises, and wide economic moats."
Energy stocks were weak despite a decline in crude inventoriesthat was more than expected, as traders focused on Enbridge's announcement that it had fixed a leaking pipeline. Oil fell just above $76 a barrel.
Energy giants Chevron and Exxon slumped, as did drillers, including Diamond Offshore Drilling and Schlumberger .
Meanwhile, BP shares rose after outgoing CEO Tony Hayward defended his company's safety recordat a hearing before British lawmakers.
The technology sector was higher, but chip stocks slumped after Goldman Sachs downgraded Micron Technology to "neutral," from "buy," citing weakness in the PC market due to a surge in tablet sales. The bank also downgraded chipmaker Maxim Integrated Products to "sell."
Meanwhile, shares of Apple rose after BMO raised its target price on the iPod maker to $320 from $315. Rivals Microsoft and Hewlett-Packard also climbed.
Elsewhere in technology, Yahoo! rose after news the online media company doesn't plan to sell its 39 percent stakein Alibaba Group, the Chinese Internet firm.
Homebuilders, including Beazer Homes , Hovnanian Enterprises and PulteGroup, tumbled after a report showed continued weakness in the housing sector. U.S. mortgage applications for both home purchases and refinancing fell 8.9 percent in September, as refinancing slowed for a second week, and a survey from real estate website Trulia.com showed more sellers are slashing asking prices for a third month.
Also Beazer said orders for new homes could be as low at 700,000 vs. 767,000 previously supported. And Standard & Poor's Ratings Service on Tuesday cut PulteGroup's debt ratings and lowered its outlook on Hovananian, because of the expiration of the federal tax credit for first-time homebuyers.
Industrials were mixed following several reports of poor third quarter outlooks for steel companies and after a report that U.S. industrial production rose 0.2 percent in Augustfrom a 0.6 percent gain in July, in line with expectations, according to Federal Reserve data. July's figures were unusually strong because of a boost in auto manufacturing. Excluding motor vehicles and parts, total industry output increased 0.4 percent in August, up from 0.3 percent in July.
AK Steel slumped after the steel firm said higher raw material and operating costs will hurt earnings, while Steel Dynamics was flat after the company cited lower prices and lower volumes from recycling operations. This comes after Nucor lowered its third quarter earnings outlook on Tuesday, citing slowing demand.
Gold hovered near record highs, holding flat around $1,265 an ounce, as investors continued to flock to the safety of the precious metal.
Genpact advanced on rumors it will be taken over by information technology services and consulting firm Cognizant , according to The Financial Express, an Indian-based newspaper. The acquisition would put Cognizant ahead of rival Infosys as the leading IT services provider in the U.S.
In other economic news, the September Empire State Manufacturing Survey had an unexpected drop to 4.14 in Septemberfrom 7.10 in August. The consensus forecast was for an index reading of 6.4.
And capacity utilization, a measure of slack in the economy, rose modestly to 74.7 percent.
Meanwhile, import prices rose 0.6 percent after rising by a revised 0.1 percent in July, according to the Labor Department.
MasterCard shares soared to lead the S&P 500 after the credit-card provider said it expects its earnings per share to grow at a compound annual rate of over 20 percent for 2011 through 2013.
Pall surged to the top of the broad-market index as well after reporting a plunge in fourth quarter profits but stronger revenues and gross margins. The maker of filtration and water-purification products for industry and life sciences pointed to strong sales for most of its businesses.
Kraft, meanwhile, said its purchase of Cadbury will add $1 billion in revenue lead to $750 million in cost savings by 2013. Along with productivity gains, flat overhead growth and pricing to offset input costs, Kraft said it would have higher gross profit margins.
On the Calendar:
THURSDAY: PPI, current account, jobless claims, Philly Fed survey; before-the-bell earnings from FedEx, after-the-bell earnings from Oracle and Research In Motion
FRIDAY: CPI, consumer sentiment
More From CNBC.com: