By Anora Mahmudova, MarketWatch

NEW YORK (MarketWatch) -- U.S. stocks Tuesday finished a choppy trading session higher, boosted by stronger-than-expected consumer confidence data. The main indexes recorded small gains after two days of losses.

The S&P 500 (SPX) ended the day 8.19 points, or 0.4%, higher at 1,865.63. The Dow Jones Industrial Average (DJI) gained 91.19 points, or 0.6%, to 16,367.88.

The Nasdaq Composite (RIXF), finished the day higher after briefly dipping into red. The tech-heavy index gained 7.88 points, or 0.2%, to 4,234.27.

"Today's economic data were as expected and market reaction has been muted," said Brad Sorensen, director of market and sector research at Schwab Center for Financial Research.

"Markets are waiting for a catalyst to take them higher or lower, as things are once again quiet overseas, earnings season has not started yet and valuations are not too low or too high," he added.

Read the recap of live stock market coverage.

Investors welcomed a stronger reading on consumer confidence. Led by rosier expectations, a gauge of U.S. consumer confidence jumped this month to the highest level in more than six years, blowing past a forecast from economists.

A duo of housing data were in line with expectations.

U.S. home prices slipped in January for a third straight month after a particularly harsh winter, according to data released Tuesday, as strong year-over-year appreciation showed signs of moderating. New U.S. homes sold at an annual rate of 440,000 in February, down 3.3% from January's one-year high, the government said Tuesday. Read also: Housing market's pricing recovers unevenly across the U.S.

Markets were reassured by comments from Philadelphia Fed president Charles Plosser, who said in an interview with CNBC that short-term interest rates should hit 4% at the end of 2016. He also said the market reaction to Federal Reserve Chairwoman Janet Yellen's comments after last week's Federal Open Market Committee meeting was "puzzling." He said her timetable of a rate hike six months after the end of bond buying "wasn't a wildly unexpected time frame." Her comments sparked a selloff for stock markets last Wednesday.

Among individual stocks, Plug Power Inc. (PLUGD) surged 49% to $8.48 after chief executive Andy Marsh told MarketWatch that he will be announcing a deal with a global automaker in two to three weeks.

Rival FuelCell Energy Inc. (FCEL) and Ballard Power Systems Inc (BLDP) also rose in tandem, both closing up 20% and 32% respectively.

In earnings news, McCormick (MKC) shares rallied 5.5% after the spice maker on Tuesday reported fiscal first-quarter earnings ahead of a forecast.

Walgreen Co. (WAG) rose 3.3% after the company reported its fiscal second-quarter earnings, which fell slightly from the year-earlier period. The drugstore chain said it would close 76 stores later this year.

Shares of Sonic Corp. (SONC) rallied 11% after the company posted a 15% profit gain.

Shares of Carnival Corp (CCL) dropped more than 5% after the cruise company reported that it swung to a fiscal first-quarter loss. Its outlook for the next quarter came in below Wall Street's expectations.

Himax Technologies Inc. (HIMX) sank 11% after Bank of America Merrill Lynch downgraded the semiconductor maker to underperform, saying the highly competitive market will make margin expansion difficult for Himax, according to news reports.

In other markets, stocks in Asia showed a modest pullback, as investors continued to mull downbeat China manufacturing data from the weekend and a slightly disappointing Markit preliminary U.S. purchasing managers index. European stocks closed higher, shrugging off soft German business-confidence data.

Gold prices (GCM4) were little changed. Oil (CLM4) prices ticked down. The ICE dollar index (DXY) , which measures the U.S. unit against a basket of six major rivals, rose to 79.94, from 79.923 late Monday.

More must-reads from MarketWatch:

Why Berkshire Hathaway will stomp small caps

44 stocks on takeover target radar: Morgan Stanley

Don't bet against Buffett

Subscribe to WSJ: http://online.wsj.com?mod=djnwires

FuelCell Energy (NASDAQ:FCEL)
Historical Stock Chart
From Feb 2024 to Mar 2024 Click Here for more FuelCell Energy Charts.
FuelCell Energy (NASDAQ:FCEL)
Historical Stock Chart
From Mar 2023 to Mar 2024 Click Here for more FuelCell Energy Charts.