IE 11 is not supported. For an optimal experience visit our site on another browser.

Stocks finish higher, posting robust gains for April

Stocks reversed their early losses to finish higher on the final day of the month, with all three major averages posting robust gains for April, despite some weak corporate earnings and mixed economic data.

The Dow closed higher for the fifth-straight month, while the S&P 500 and Nasdaq is logged their sixth-straight month of gains.

(Read More:After-Hours Buzz: DWA, WU, QCOR & More)

The Dow Jones Industrial Average eked out a gain of 21.05 points to close at 14,839.80, ending higher for the 16th straight Tuesday. IBM and Microsoft led the blue-chip gainers, while Pfizer tumbled.

The S&P 500 rose 3.96 points to finish at 1597.57, hitting a new all-time high. TheNasdaq added 21.77 points to end at 3,328.79, closing at a new 12.5-year high. The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, ended below 14.

For the month, the Dow rallied 1.79 percent, the S&P 500 jumped 1.81 percent, and the Nasdaqclimbed 1.88 percent. Microsoft was the biggest monthly gainer on the Dow, while Hewlett-Packard sagged.

Telecomsand utilities were the best sector performers, while energy and industrials lagged.

(Read More: 'Rotate in May' Could Be the Real Spring Market Play)

"I've been warning people about a correction...but pullbacks are still being viewed as buying opportunities," said Randy Frederick, managing director of active trading at derivatives at the Schwab Center for Financial Research. "I remain bullish overall for 2013, but we're still likely to see a pullback in the second quarter. Stay long the market, but continue to hedge on the downside."

(Read More: Global Concerns? Bet on Small Caps: Goldman Sachs)

Among earnings, Pfizer declined after the drugmaker reported quarterly results that fell short of Wall Street expectations, citing the stronger dollar and the spin-off of its animal health unit Zoetis. The company also lowered its full-year outlook.

U.S. Steel slumped after the steelmaker posted a quarterly loss as its sales fell more than 10 percent. And Cummins fell after the heavy-equipment maker reported quarterly results that missed forecasts.

Pitney Bowes plunged to lead the S&P 500 laggards after the digital communication software maker posted disappointing earnings and also forecast full-year profit largely below estimates.

BP gained after the oil giant announced a sharp rise in earnings, with the sale of its Russian venture TNK-BP offsetting a fall in oil and gas production.

Major European banks including Deutsche Bank and UBS both posted better-than-expected first quarter profits. However,Anheuser-Busch InBev, the world's largest brewer, cut its outlook for full-year growth in its second-biggest market, Brazil, after earnings fell short of expectations.

Dreamworks Animation is scheduled to post earnings after the closing bell.

To date, a little over 60 percent of S&P 500 companies have posted quarterly results, with 69 percent of firms topping earnings expectations, according to the latest data from Thomson Reuters. If all remaining companies report earnings in line with estimates, earnings will be up 4 percent from last year's first quarter.

Meanwhile, only 44 percent companies have beaten revenue forecasts. On average, sales have come in 1 percent below estimates.

Apple rallied near session highs after the tech giant launched the biggest-ever non-bank bond issue at $17 billion to help pay for the $100 billion capital return program for shareholders. The stock turned positive for April and is on track for its best monthly gain since August.

(Read More: Apple as Top Yield Play: Dan Niles)

Best Buy surged to lead the S&P 500 gainers after the consumer electronics retailer said it is selling its stake in a joint venture with Europe's Carphone Warehouse,in the latest sign that the retailer is retreating from its European expansion.

On the economic front, single-family home prices jumped in February, posting their best annual gain since in seven years, according to the S&P/Case Shiller composite index of 20 metropolitan areas.

And consumer confidence jumped to 68.1 in April, according to the Conference Board, lifted by a better outlook for the job market. Analysts polled by Reuters expected a reading of 60.8 from 59.7 in arch.

Meanwhile, a gauge of manufacturing activity in the Midwest showed a slight contraction in April, with the Chicago PMI index sliding to 49 in April, falling short of expectations for 52.5.

And labor costs rose 0.3 percent in the first quarter, which was less than expected and pointed to benign wage inflation, according to the Labor Department. However, the data may have been distorted by an error found in benefits data for sales and office workers, the department said, but didn't have a major impact on the reading. Analysts polled by Reuters had expected a 0.5 percent increase in overall labor costs.

In macroeconomic news, expectations are high for central banks to continue supporting the global economy with monetary easing, ahead of the Federal Reserve's two-day meeting later on Tuesday and the European Central Bank's (ECB) policy review on Thursday.

(Read More: Wall Street Sees No End to QE Until at Least 2014)

"Given the fact that QE3 is still in place, the market has potential to outperform what we had already thought," said Frederick, adding that barring any unexpected events, the market is likely to continue to rally above current levels.

At the end of the week, the government is scheduled to release its widely-watched monthly employment report, which is expected to show 150,000 new non-farm jobs were added in April, according to an estimate from Reuters.

—By CNBC's JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)