Energy and commodity shares lifted Wall Street to modest gains on Monday, but the lowest volume so far this year indicated the equity rally may be near a top.

The S&P 500 edged up, trading near its highest since June 2008, nominally a good sign, but the index was stuck in the 1,325-1,333 area without enough buyers to get through this technical hurdle.

A mere 6.6 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, the lowest volume so far this year and far below the 8 billion daily average for 2011.

Shawn Hackett, president at Hackett Advisors in Boynton Beach, Florida, said rising index levels on falling volume sets the stage for a pullback.

Everything I see suggests the driver now is a last bit of greed and momentum before the market runs out of buyers, he said.

Three-month copper hit a record high after Chinese import figures suggested strong demand for basic materials. Freeport McMoRan Copper & Gold jumped 4.9 percent to $56.14 and the PHLX Gold/Silver index <.XAU> rose 2.2 percent.

The Dow Jones industrial average <.DJI> dipped 5.07 points, or 0.04 percent, to 12,268.19. The Standard & Poor's 500 Index <.SPX> rose 3.17 points, or 0.24 percent, to 1,332.32. The Nasdaq Composite Index <.IXIC> gained 7.74 points, or 0.28 percent, to 2,817.18.

Wal-Mart Stores Inc was one of the worst performers on the Dow after JPMorgan downgraded the stock. Shares fell 1.6 percent to $54.80.

The S&P 500 has gained nearly 27 percent since the start of September. It now stands near the 50 percent extension of last year's slide from April to July and also near 100 percent advance from the low hit in March 2009.

The coincidence of the levels makes the technical resistance stronger.

Still, some traders see residual strength in the market and are willing to buy on any declines in prices.

We wouldn't be surprised to see a pullback, but longer term we think the market has room to grow, said Mitch Rubin, chief investment officer at RiverPark Advisors in New York.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of about 5 to 4, while on the Nasdaq, about seven stocks rose for every six that fell.

U.S. President Barack Obama proposed a federal budget that he said would cut the U.S. deficit by $1.1 trillion over the next 10 years. Congress must approve the plan, and Republicans, who are in the majority in the House, said it did not curb spending enough.

Obama's budget would provide $8 billion for investment in clean energy, but big drugmakers might take a hit from generic competition under two proposals in the plan.

Among alternative energy companies, Trina Solar gained 5.2 percent to $28.79 while GT Solar International climbed 2.7 percent to $11.50. Drugmaker Merck & Co , a Dow component, slid 0.8 percent to $32.82.

Green Mountain Coffee Roasters Inc shares jumped 6.7 percent to $46.35 after Reuters reported the company has been in partnership negotiations with Starbucks Corp .

Recent merger and acquisition activity continued.

EchoStar Corp agreed to buy Hughes Communications Inc for about $1.33 billion. Private equity firm Clayton, Dubilier & Rice agreed to take Emergency Medical Services Corp private for about $3 billion.

Shares of Hughes fell 3.7 percent to $59.47 while EchoStar rose 3.2 percent to $30.84. Emergency Medical fell almost 11 percent to $62.92.

(Reporting by Rodrigo Campos, additional reporting by Ryan Vlastelica; Editing by Kenneth Barry)