Stocks rallied in the first week of the year after U.S. lawmakers reached a deal to avoid the "fiscal cliff," and then pushed higher toward record levels as optimism about the housing market recovery grew. Decent company earnings for the fourth quarter and an improving job market also helped lift markets.
The Dow Jones industrial average ended the month up 5.8 percent, its strongest January since 1994, according to S&P Capital IQ data. The Standard & Poor's 500 finished the month 5 percent higher, its best start to the year since 1997.
"There's not a whole lot of bears left here," said Jeff Hirsch, the editor of the Stock Trader's Almanac, adding that the market may struggle to gain further in February.
Stocks have also benefited as investors have put money into equities in January. By one measure, the monthly flow into stock funds was the largest in nine years.
About $51 billion in net deposits was moved into stock funds and so-called hybrid funds, which invest in a mix of stocks and bonds, consultant Strategic Insight said Thursday. That's the most since $56 billion flowed in during January 2004.
On Thursday, stocks drifted lower as investors digested more earnings results and reports on the economy.
The Dow Jones industrial average fell 49 points to 13,860.58. The S&P 500 dropped 4 points to 1,498.11 and the Nasdaq composite was little changed at 3,142.13.
The Dow is just 304 points from its all-time high.
Among companies reporting earnings Thursday, UPS Inc., the world's biggest package-delivery company and an economic bellwether, fell 2.4 percent to $79.29. The company's fourth quarter was hurt by weak global trade, and it forecast 2013 results below expectations.
January's rally started to slow Wednesday after a report showed that the economy unexpectedly contracted in the fourth quarter of last year.
Stocks have gained against a backdrop of low borrowing costs and a slow, but steady, economic recovery. However, the market may struggle to build on those gains in the immediate future as traders and investors turn their attention back to Washington, said Ernie Cecilia, chief investment officer at Bryn Mawr Trust.
The budget deal struck at the start of the year dealt with taxes, but across-the-board spending cuts were pushed back from Jan. 1 to March 1. While a showdown over the nation's borrowing limits appears to have been put off, lawmakers have yet to agree on how best to reduce government spending. Those negotiations could be protracted and increase stock market volatility, said Cecilia.
More government reports Thursday also gave investors a better picture of the health of the economy.
The number of Americans seeking unemployment aid rose sharply last week but remained at a level consistent with moderate hiring.
Investors will look for further clues about the strength of the jobs market Friday, when the closely followed monthly nonfarm payrolls report is published.
The yield on the 10-year Treasury note, which moves inversely to its price, was little changed at 1.99 percent.
Among other stocks making big moves:
-- Under Armour gained $2.74, or 5.7 percent, to $50.87, after the company said its fourth-quarter earnings jumped 10 percent and the clothing company predicted revenue growth of at least 20 percent in each of the next two years.
-- CononcoPhillips fell $3.09, or 5.1 percent, to $58 after the oil company said earnings fell as prices for oil and natural gas declined. The Houston-based company also said 2013 production would decline.
-- JDS Uniphase added $2.11, or 17 percent, to $14.51 after the technology company reported stronger-than-expected earnings on improved revenue and margins late Wednesday.
-- Constellation Brands slid $6.81, or 17.4 percent, to $32.36 after the Justice Department sued to stop Anheuser-Busch InBev's proposed $20.1 billion purchase of Mexican brewer Grupo Modelo, which would unite the ownership of popular beers like Budweiser and Corona. Constellation, a liquor and wine producer, was set to expand as part of a side deal in the merger.
-- Qualcomm Inc., a maker of chips for mobile devices, rose 3.9 percent to $66.02 after it said late on Wednesday that its earnings surged. Its revenue was boosted by growing global demand for smartphones.