The S&P and Nasdaq notched their eighth week of gains out of the last nine, but momentum ran out on Friday as stocks ended the day lower in a thinly traded session.

Energy shares were the big losers in the broad decline, falling alongside crude oil prices, though other cyclical groups, including industrials and financials, also lost altitude.

The S&P 500 has gained almost 9 percent since the beginning of the year. But mixed economic data and tensions between Iran and Israel have given investors few reasons lately to chase the market higher after three straight winning weeks for the benchmark index.

We're in a small pullback, but that's to be expected after a very strong rally, said David Kelly, the chief market strategist for JPMorgan Funds in New York, who added that he considered stocks cheaper than other asset classes like bonds.

Unless something major happens, we'll continue to move up, he said. It's like we're trying to find our way around a dark room: We're making progress, but slowly because of all the uncertainty out there about Europe and the Middle East.

The day's strongest sector was telecom <.GSPL>, which rose 0.5 percent. The group, which is considered a defensive play, was led higher by AT&T Inc, up 0.8 percent at $30.87, and Verizon Communications , up 0.6 percent at $38.67. Both stocks are Dow components.

The Dow Jones industrial average <.DJI> dipped 2.73 points, or 0.02 percent, to 12,977.57 at the close. The Standard & Poor's 500 Index <.SPX> slipped 4.46 points, or 0.32 percent, to 1,369.63. The Nasdaq Composite Index <.IXIC> shed 12.78 points, or 0.43 percent, to close at 2,976.19.

For the week, the Dow inched down 0.05 percent, while the S&P 500 rose 0.3 percent and the Nasdaq added 0.4 percent. On Tuesday, the Dow closed above 13,000 for the first time since May 2008, though it has subsequently struggled to maintain that level.

I'm a little dubious of the prospect of staying above 13,000, said Tim Speiss, head of personal wealth advisors at EisnerAmper in New York. I expect we'll see more volatility at this level, and a significant uptick from these levels isn't warranted.

Investors kept a close eye on oil prices, which have risen more than 15 percent since the start of February. A steep rise in crude and gasoline prices could cut into consumer spending and damage the economic recovery.

We're already at the level where crude prices are a concern for economic growth, Speiss said.

U.S. crude oil futures fell more than 2 percent, or $2.14, to settle at $106.70 a barrel a day after hitting a 10-month high above $110 on supply concerns in the Middle East.

The decline hit energy shares, sending the S&P energy sector index <.GSPE> down 1.1 percent. Peabody Energy fell 6.5 percent to $32.89 while Exxon Mobil Corp declined 0.6 percent to $86.33.

The market capitalization of Exxon, at $409.25 billion the second-largest U.S. company, is now almost $100 billion less than Apple Inc , the biggest U.S. company.

Aides to U.S. President Barack Obama and Israeli Prime Minister Benjamin Netanyahu are scrambling to bridge differences over what Washington fears could be an Israeli attack on Iran's nuclear sites, a concern at the heart of the recent spike in oil prices. Both leaders will meet on Monday.

The U.S. dollar's strength against the yen and the euro could continue to pressure oil and other commodity prices.

Yelp Inc's stock surged as high as $26 per share in its debut, up more than 70 percent from its IPO price. The initial public offering was priced at $15 a share, above the expected price range, valuing the U.S. consumer review website at nearly $900 million. Shares closed their first day of trading at $24.58, up 63.9 percent.

Wynn Resorts Ltd retracted an announcement that it had advanced a major project in Macau, saying it had been made in error after its shares surged on the news. Wynn Resorts' shares closed 4.3 percent higher at $127.27 after being halted earlier in the session.

U.S. food and drink maker Sara Lee Corp will pay a special $3 dividend after it completes the spin-off of its coffee and tea business, expected by the end of June. Sara Lee's shares shot up 7.1 percent to $21.83.

Shares of Shutterfly Inc jumped 16.5 percent to $31.36 after bankrupt Eastman Kodak agreed to sell its online photo services business to Shutterfly for $23.8 million.

Volume was light, with about 6.02 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, below last year's daily average of 7.84 billion.

Nearly two-thirds of the shares traded on the New York Stock Exchange closed in negative territory, while on the Nasdaq, 68 percent of stocks closed lower.

(Reporting by Ryan Vlastelica; Editing by Jan Paschal)