By Saumya Vaishampayan and Anora Mahmudova, MarketWatch

NEW YORK (MarketWatch) -- U.S. stocks in May posted the biggest monthly gains since February, with the S&P 500 and Dow Jones Industrial Average finishing the month at records.

Both the Nasdaq Composite and Dow in May turned positive for the year.

The S&P (SPX) closed up 3.5 points, or 0.2%, to 1,923.57. The benchmark index gained 1.2% for the week and 2.1% in May.

The Dow (DJI) rose 18.4 points, or 0.1%, to 16,717.17. The blue-chip index notched a weekly gain of 0.7% and gained 0.8% for the month.

The Nasdaq (RIXF) fell 5.3 points, or 0.1%, to 4,242.62. The tech-heavy index ended with a 1.4% gain for the week and a 3.1% gain in May. The monthly gain was the index's first in three months.

Kristina Hooper, U.S. investment strategist at Allianz Global Investors, said today's cautious mood in the market is colored by how low the 10-year Treasury yields are.

"Many investors are struggling to understand why 10-year yields are below 2.5% and whether they are signaling something they don't know. While historically such low rates signal a weakening economy, we think there are other reasons behind it, such as lower supply and attractiveness compared to other safe government bonds," Hooper said.

"We believe the environment for stocks is still good, as rates are low and inflation is low. Tapering of the QE appears fully priced in and all eyes are on the Fed funds rate," she added.

In economic news, consumer spending in the U.S. fell in April -- the first decline in a year -- as Americans cut back on car purchases and spent less on utilities such as natural gas and electricity as the weather warmed up. Meanwhile, inflation pressures continued to build last month. MarketWatchSpending on energy plunged by 3% in April, leading to the first drop in consumer spending in a year. Excluding energy, spending rose 0.1%.Why economists aren't freaking out about the negative GDP numbers

Separately, a gauge on consumer sentiment fell in May, according to a report from the University of Michigan and Thomson Reuters. Economists polled by MarketWatch had expected a final May level of 82.5, compared with a preliminary reading for the month of 81.8.

Big Lots surges, Express tumbles after quarterly results

Among major movers, Big Lots Inc. (BIG) surged 13% after the retailer raised its outlook for the current fiscal year, while first-quarter revenue beat expectations.

Ann Inc. (ANN) rose 4% after the apparel retailer reported first-quarter adjusted profit that slightly beat Wall Street forecasts.

Express Inc. (EXPR) shares tumbled 7.5% after the retailer posted a fall in first-quarter profit.

An even bigger loser was Infoblox Inc. (BLOX). Shares plummeted 37% after the network-control company said Chief Executive Robert Thomas was stepping down. Revenue for the first quarter fell short of expectations.

Apple Inc. (AAPL) shares were down 0.4%. Goldman Sachs raised its price target on the stock to $720 from $635. Read: Apple hits new "Beats" ahead of WWDC

Overseas and other financial markets

In overseas markets, European stocks posted their seventh week of gains, while Asian stocks closed mostly lower. Gold futures (GCQ4) posted their worst monthly losses this year and crude for July delivery (CLN4) fell.The dollar (DXY) declined against its European rivals.

More must-reads from MarketWatch:

Get set for summer melt-up, then a 'nasty correction'

Stocks could fall 15% to 20% as 'QE fluff' comes out of the market

How to know if the stock market has reached a top

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