The S&P 500 extended its rally on Monday to climb within 10 percent of its historic closing high, after Apple said it would pay a $10 billion annual dividend and buy back stock.

The benchmark index is now at its highest level since May 2008 and 10 percent below the record close of 1,565.15 set in October 2007.

This is the type of thing that typically gets retail investors back in the market, said Peter Jankovskis, co-chief investment officer at OakBrook Investments in Lisle, Illinois.

Analysts have said a flow of retail investor money could fuel the next leg of the rally that has driven the S&P 500 up 12 percent so far this year.

Apple Inc , the world's most valuable publicly traded company, rose 2.7 percent to $601.10 - marking the first time the stock has ended above $600 - and inching closer to a 50 percent gain this quarter. Apple, the maker of the iPad and the iPhone, said it will pay a dividend of $2.65 a share quarterly, starting in July, and also announced it will buy back $10 billion in stock, starting in the next fiscal year.

The announcement from Apple comes less than a week after major U.S. banks responded to the results of the Federal Reserve's stress tests by announcing bigger dividends and billions of dollars in stock buybacks.

These increases, alongside a steady stream of upbeat U.S. economic data, have cleared the way for more investment in stocks.

You're getting initiations and increases in dividends, and people are starting to recognize there is nowhere else to go, said Jack de Gan, chief investment officer at Harbor Advisory Corp in Portsmouth, New Hampshire.

An S&P index of small-cap stocks <.SML> closed at an all-time high, while an index of midcap shares <.MID>, near their record high, confirmed the broad-based nature of the U.S. equities rally. <.N/S>

Financials were the second-best performing among the top 10 S&P 500 sectors, ranking only behind the tech sector. The S&P financial index <.GSPF> gained 0.6 percent.

The Dow Jones industrial average <.DJI> edged up 6.51 points, or 0.05 percent, to 13,239.13 at the close. The S&P 500 Index <.INX> gained 5.58 points, or 0.40 percent, to 1,409.75. The Nasdaq Composite <.IXIC> rose 23.06 points, or 0.75 percent, to 3,078.32.

UBS raised its price target for US Steel's stock by almost 24 percent, attracting a blitz of investor attention, and the hard metal maker's shares jumped 6.4 percent to $31.64.

United Parcel Service Inc rose 2.8 percent to $81.11 as it clinched a deal to buy Dutch peer TNT Express , making UPS the market leader in Europe.

Broadcom Corp gained 2.6 percent to $38.78 after the chipmaker said it won a preliminary injunction against Emulex Corp in a patent infringement lawsuit.

On the economic front, U.S. homebuilder sentiment was unchanged in March, holding at its highest level since June 2007, while sentiment in February was revised lower.

About 6.5 billion shares changed hands on the New York Stock Exchange, the Nasdaq and Amex, slightly below the daily average so far this year of 6.9 billion shares.

Advancers outnumbered decliners buy roughly 9 to 5 on both the NYSE and Nasdaq.

(Reporting by Rodrigo Campos; Editing by Jan Paschal)