Market participants were also encouraged by signs of progress in talks about releasing aid to debt-saddled Greece and piled into U.S. retail shares as Black Friday got the holiday shopping season under way.
U.S. stock market trading ended early and was closed on Thursday for the Thanksgiving holiday.
Volume was the lightest of the year, though the session was abbreviated. Shares of big-cap technology companies climbed as investors took advantage of the day's upward momentum to add to positions, helping the S&P 500 rack up its second best week of 2012.
"Anyone that was on the sidelines waiting for a pullback like the one we just had in some of the tech names, they're looking for any glimpse of strong price action for 'permission' to enter into those (stocks)," said Todd Salamone, director of research at Schaeffer's Investment Research in Cincinnati, Ohio
Microsoft (>> Microsoft Corporation) helped lift the Nasdaq, gaining 2.8 percent to $27.70, while Apple Inc (>> Apple Inc.) rose 1.7 percent to $571.50.
From mid-September to mid-November, the S&P tech sector <.GSPT> shed about 13 percent as the broader market also dropped.
Research in Motion <RIMM.O> surged on optimism about its soon-to-be-launched BlackBerry 10 devices that will vie against Apple's (>> Apple Inc.) iPhone and Android-based smartphones. RIM was up 13.6 percent at $11.66.
Greece said the International Monetary Fund had relaxed its debt-cutting target for the country, suggesting lenders were closer to a deal for a vital aid tranche to be paid. But other sources involved in the talks cautioned the funding gap was far bigger than Greece has suggested.
Euro zone finance ministers, the IMF and European Central Bank (ECB) failed earlier this week to agree on how to shrivel the country's debt to a sustainable level and will have a third attempt at resolving the issue on Monday.
The Dow Jones industrial average <.DJI> gained 172.79 points, or 1.35 percent, to 13,009.68. The Standard & Poor's 500 Index <.SPX> rose 18.12 points, or 1.30 percent, to 1,409.15. The Nasdaq Composite Index <.IXIC> climbed 40.30 points, or 1.38 percent, to 2,966.85.
The S&P 500 broke a two-week losing streak to rise 3.6 percent. Stocks had tumbled earlier in the month on worries about the impact of tax and spending changes set to take effect from January, but hopes that politicians will reach a deal to avert the so-called fiscal cliff helped the market recoup some of those declines this week.
The Dow and S&P 500 both closed above key technical levels for the first time since Nov 6, which could provide additional support. The Dow ended above 13,000, while the S&P broke above 1,400.
The Dow rose 3.3 percent for the week, while the Nasdaq jumped 4 percent. The Nasdaq had ended lower for the previous six weeks in a row.
Volume was about 2.8 billion shares on the New York Stock Exchange, the Nasdaq and the NYSE MKT, compared with the year-to-date average daily closing volume of over 6 billion.
Advancers outnumbered decliners on the NYSE by 2,407 to 469 on the New York Stock Exchange. On the Nasdaq, advancers had the lead, with 1,775 stocks gaining and 548 shares declining.
The retail sector rose as investors looked for signs of how much consumers are spending as stores lured shoppers with Black Friday deals and discounts.
Black Friday, the day after Thanksgiving, kicks off the U.S. Christmas shopping season for retailers and is often the busiest shopping day of the year. The National Retail Federation expects sales during the holiday season to grow 4.1 percent this year compared with last year's 5.6 percent increase.
If the traffic and sales numbers look strong early on, "it usually gives a sense that the season will be in line with expectations," said Bucky Hellwig, senior vice president at BB&T Wealth Management in Birmingham, Alabama.
"The way that could work against a stronger retail season is if there's no follow-through, there could be discounting on the part of retailers."
Wal-Mart (>> Wal-Mart Stores, Inc.) rose 1.9 percent to $70.20, while Target (>> Target Corporation) gained 1.2 percent to $64.48.
(Editing by Kenneth Barry)
By Leah Schnurr