Blue-chip stocks rose to within 75 points of their closing high, as upbeat domestic factory data outweighed a stalemate in U.S. budget talks.
The Dow Jones Industrial Average added 35.17 points, or 0.3%, to 14089.66, reversing a morning loss of more than 100 points to notch its third-highest close of all time.
The Standard & Poor's 500-stock index gained 3.52 points, or 0.2%, to 1518.20.
The Nasdaq Composite Index advanced 9.55 points, or 0.3%, to 3169.74.
"This continues to be a market that looks attractive," said Sandy Lincoln, chief market strategist at BMO Global Asset Management, which oversees $120 billion. "When people see any sort of correction, they seem to be anticipating a bounce and taking the opportunity to get in."
On the economic front, the U.S. factory sector expanded a bit faster last month, bucking economists' expectations for it to slow, according to the Institute for Supply Management's manufacturing purchasing managers' index.
U.S. consumers felt even better about the economy last month than originally thought, according to Thomson-Reuters and University of Michigan's consumer-sentiment index. The reading is at its highest level since November.
In Washington, President Barack Obama said the $85 billion in automatic budget cuts, known as the sequester, would move ahead following no progress in talks between the White House and Republican lawmakers.
"We're cognizant that the sequester is now in place, but we think at the end of the day, the fundamentals that are supporting the capital markets remain intact," said Jim Russell, senior equity strategist at U.S. Bank.
For the week, the Dow industrials gained 0.6%, for its second consecutive weekly advance. The S&P 500 added 0.2%, while the Nasdaq Composite advanced 0.3%.
New on WSJ.com
See a table of monthly performances of major stock indexes from around the globe, at WSJ.com/MonthlyStats
European markets slumped, with the Stoxx Europe 600 shedding 0.3%, but gaining 0.2% for the week, after the euro-zone unemployment rate rose to a record level. Within the region, unemployment in Italy was the highest since 1992. Italy's FTSE MIB index slid 1.5%.
Data showed that manufacturing activity in the euro zone continued to contract in February, with no improvement from January.
Asian markets fell after disappointing Chinese manufacturing data. China's Shanghai Composite Index slipped 0.3% but rose 2% on the week. Australia's S&P/ASX 200 gave up 0.4% but gained 1.4% for the week.
Japan's Nikkei Stock Average bucked the region's trend, rising 0.4%, as some weakness in the yen helped underpin sentiment. The index advanced 1.9% on the week and has gained 15 of the past 16 weeks, up 12% in 2013.
Crude-oil prices fell 1.5% to settle at $90.68 a barrel, while gold slipped 0.4% to settle at $1,571.90 a troy ounce. The dollar gained against the euro and yen.
Meanwhile, Treasurys posted their biggest weekly rally in nearly four months, with the 10-year note rising in price to yield 1.855%.
In corporate news, Groupon (GRPN)
Atlantic Power (ATP.T)
Best Buy (BBY)
Deckers Outdoor (DECK)
Icahn Enterprises (IEP),
Write to Matt Jarzemsky at email@example.com