Stocks rose on Friday after euro zone leaders agreed to create a safety net to help debt-burdened Greece, while data showed consumer sentiment rose slightly more than expected in March.

Euro zone leaders unveiled a deal late Thursday in which Athens would receive coordinated bilateral loans from other countries that use the euro and the International Monetary Fund if it faced severe difficulties.

Worries about hefty debt loads of some euro zone countries have pressured equities, and the agreement relieved uncertainties about how the EU will deal the problems.

Consumer sentiment was unchanged in March from February, while gross domestic product grew 5.6 percent in the fourth quarter, dipping from the preliminary estimate of 5.9 percent.

The consumer sentiment data continues to demonstrate, to me at least, the economy continues to chug along with an upward bias, said Phil Orlando, chief equity market strategist at Federated Investors in New York.

The Dow Jones industrial average <.DJI> rose 50.87 points, or 0.47 percent, to 10,892.08. The Standard & Poor's 500 Index <.SPX> gained 6.80 points, or 0.58 percent, to 1,172.53. The Nasdaq Composite Index <.IXIC> added 12.93 points, or 0.54 percent, to 2,410.34.

Home insurers and builders got a boost after the Obama administration announced a $14 billion effort to relieve the flood of home foreclosures by giving lenders incentives to erase some mortgage debt and slash mortgage payments for the unemployed.

The KBW mortgage finance index <.MFX> gained 1.2 percent, while MGIC Investment Corp jumped 7.4 percent to $9.58. The broader S&P financial index <.GSPF> rose 1.1 percent.

Apple Inc lifted the Nasdaq after Credit Suisse raised its price target to $300 from $275, saying the iPhone maker is seeing a stronger second quarter than earlier thought. The stock rose 2.2 percent to $231.71.

(Additional reporting by Chuck Mikolajczak; editing by Jeffrey Benkoe)