NEW YORK  - US stocks finished the week modestly higher following a mixed batch of corporate earnings reports, avoiding a major retreat that had been feared early in the period.
The Dow Jones Industrial Average edged 21.51 (0.13 percent) higher to 16,458.56.
The broad-based S&P 500 advanced 6.27 (0.34 percent) to 1,838.70, while the tech-rich Nasdaq Composite Index rose 22.91 (0.55 percent) to 4,197.58.
Investors have been bracing themselves for a correction the surge in equity markets of 2013. Such a retreat seemed a real possibility Monday when all three indices fell by more than one percent ahead of the peak earnings reporting period.
But rallies on Tuesday and Wednesday positioned the market to finish the week in the black.
"Some people felt that a correction was happening," said Bill Lynch, director of investment at Hinsdale Associates.
"But then Tuesday, the market reversed itself on retail sales (data) and since then, the market has held up real well."
Analysts said most of the week 's economic data showed the US economy continues to recover at a moderate pace.
December retail sales edged 0.2 percent higher, the Federal Reserve "Beige Book" saw "moderate" growth in most of the US, while a much-watched survey of New York state manufacturers reached its highest level in more than a year.
Analysts were more ambivalent about corporate earnings following a spate of releases from banks and other large financial institutions.
"Quite frankly, a lot of the reports haven't been that good and the overall markets have kind of hung in there," said Mace Blicksilver, director of Marblehead Asset Management.
"So this is giving people a little bit of encouragement."
"It was mixed ," Dan Greenhaus, chief global strategist at BTIG, said of the first round of fourth quarter earnings reports.
Most of the large banks reported higher year-on-year earnings , but there were enough unanswered questions and red flags to keep the sector from rallying. Financials in the S&P 500 finished the week 0.5 percent lower.
JPMorgan Chase profits bested analyst expectations, but company executives pointedly avoided any optimistic predictions about when the company's costly legal problems would wind down.
Bank of America and Morgan Stanley announced large new legal costs, while analysts fretted about weak trading results at Citigroup and Goldman Sachs.
Still, the industry's tone remains generally positive about its prospects in light of the recovering US economy.
"The foundation is there for us to grow and move the company forward," said Bank of America chief financial officer Bruce Thompson.
Analysts were more troubled by releases from retailers that continued to point to a disappointing holiday shopping season.
The worst came from Best Buy, which lost more than one-third of its value after disclosing that domestic comparable store sales declined 0.9 percent from a year earlier during the holiday shopping period.
Women's athletic clothes retailer Lululemon Athletica slashed its earnings forecast on weak sales, and J.C. Penney announced plans to close 33 stores and cut 2,000 jobs as part of its turnaround effort.
Among other headliners, General Motors announced its first corporate divided since the government rescue of 2008 in the same week that its new chief executive Mary Barra officially took over.
The news was tempered somewhat by a modest profit outlook for 2014 that left shares 3.6 percent lower for the week .
In merger and acquisition news, Google announced plans to acquire Nest, which makes smartphone-linked thermostats, in a deal valued at $3.2 billion.
Johnson & Johnson received a binding $4.15 billion offer from Carlyle Group for a medical testing unit.
US healthcare service group McKesson announced that its proposed $8.3 billion bid to take over German pharmaceuticals wholesaler Celesio had failed.
Time Warner Cable also continued to balk at a takeover offer from Charter Communications.
Corporate earnings will continue to take center stage next week with reports from a number of large companies, including IBM, Delta Air Lines, Johnson & Johnson, McDonald's and Procter & Gamble.
It will be fairly quiet week as far as economic reports.