U.S. Markets closed

US STOCKS-S&P 500 ends at record after Yellen's weather talk

* Yellen: Weather likely to blame for economic weakness

* S&P 500 now up 0.3 percent for the year

* J.C. Penney, other retail shares rally after results

* Dow up 0.5 pct; S&P 500 up 0.5 pct; Nasdaq up 0.6 pct

By Caroline Valetkevitch

NEW YORK, Feb 27 (Reuters) - The S&P 500 closed at a record on Thursday and ended in positive territory for the year after Federal Reserve Chair Janet Yellen said harsh weather seems to be to behind recent U.S. economic softness.

That gave some relief to investors who supported the view that heavy snowstorms and unusually cold weather - and not worsening fundamentals - were to blame for weak U.S. employment, retail sales and other data.

The advance lifted the S&P 500 above its 2013 year-end closing level of 1,848.36, which has served as resistance in recent sessions.

"The market was worried. She could have excluded weather and perhaps talked more about the soft patch," said Quincy Krosby, market strategist at Prudential Financial, which is based in Newark, New Jersey.

"I think she gave the market some comfort that she thought it was probably mostly due to weather-related issues."

Testifying before the Senate Banking Committee, Yellen also said the Fed would watch carefully to make sure weather was indeed behind the recent weakness. But she said it would take a "significant change" to the economy's prospects for the central bank to put plans to reduce its bond-buying program on hold.

Some retailers scored sharp gains for a third session, with the shares of J.C. Penney Co Inc and others jumping after the companies posted strong results.

Mylan Inc gave one of the biggest boosts to both the S&P 500 and Nasdaq. Mylan's shares shot up 9.4 percent to end at $56.27 after the U.S. generic drugmaker gave a 2014 forecast above Wall Street's estimates. Mylan also said it plans to make a "substantial" transaction this year that would add to future earnings.

The Dow Jones industrial average rose 74.24 points or 0.46 percent, to end at 16,272.65. The S&P 500 gained 9.13 points or 0.49 percent, to finish at 1,854.29, surpassing its previous record closing high set on Jan. 15.

The Nasdaq Composite added 26.869 points or 0.63 percent, to close at 4,318.933.

For the year, the S&P 500 index is now up 0.3 percent.

After the bell, Gap Inc shares slid 1 percent to $43.24 after the clothing retailer reported results. Shares of Deckers Outdoor Corp tumbled 12.5 percent to $74.05 after the company, whose brands include UGG boots and Teva sandals, posted earnings.

During the regular session, J.C. Penney shares surged 25.3 percent to $7.47, a day after the U.S. department store chain forecast more improvement in its comparable sales and gross profit margin this fiscal year.

The S&P retail index has climbed 4.2 percent for the week so far, including its slim gain of 0.1 percent on Thursday.

Among other retailers, Best Buy Co Inc reported a better-than-expected profit on Thursday. The stock rose as high as $28.19 before ending at $25.57, down 1 percent.

Sears Holding Corp reported a quarterly loss that narrowed from the year-ago period, sending its stock up 6.5 percent to $43.01. Kohl's Corp said it expected modest sales gains in its new fiscal year and reported a lower fourth-quarter profit. Shares of Kohl's rose 2.4 percent to $55.74.

The day's economic data added to the positive tone, with orders for long-lasting U.S. manufactured goods excluding transportation, or durable goods excluding transportation, and a gauge of business spending unexpectedly rising in January.

About 6.5 billion shares changed hands on U.S. exchanges, below the 7 billion average so far this month, according to data from BATS Global Markets.

Advancers beat decliners on the New York Stock Exchange by a ratio of 2 to 1. On the Nasdaq, 17 stocks rose for every nine that fell.