It's the best start for stocks in 15 years.
In what was mostly a slow and steady climb, the Dow Jones industrial average rose 3.4 percent in January and the Standard & Poor's 500 gained 4.4 percent, the best performances for both indexes to open a year since 1997.
Investors were encouraged by modest but welcome improvement in the U.S. economy, including an 8.5 percent unemployment rate, the lowest in almost three years. Corporate profits didn't wow anyone — except Apple's — but they were good enough.
"I don't see anything really glamorous or tremendous about the economy or earnings," said Jerry Harris, chief investment strategist at the brokerage Sterne Agee. "But I think they're very acceptable, and things are grinding along."
An unexpected drop in consumer confidence dragged stocks down on the final day of the month. The Dow Jones industrial average finished down 20.81 points, or 0.2 percent, at 12,632.91.
The broader market fared better. The S&P barely finished in the red, declining 0.60 point to 1,312.41. The Nasdaq composite index rose 1.90 points to close at 2,813.84. The Nasdaq gained 8 percent for the month, its best January since 2001.
In January 1997, the last time stocks had such a fast start, the S&P gained 6.1 percent. Bill Clinton was inaugurated for his second term. An Asian financial crisis and "Titanic" lay ahead. Later that year, the Dow crossed 7,000 and 8,000 for the first time.
This January, analysts said, investors had such low expectations for the economy that it was easy for things to turn out better than expected.
"There are no big surprises," said Kim Caughey Forrest, a senior equity analyst at money manager Fort Capital Group. "That's the kind of ho-hum economy that we are in right now."
The Dow closed at 12,217.56 at the end of last year, then started this year with a pop — a gain of 179.82 points on opening day. It was the kind of big swing investors became accustomed to in 2011.
Since then, it's been a quiet ascent: 19 days in a row of moves of less than 100 points. The last time the Dow had such a placid stretch was a 34-day run that started Dec. 3, 2010.
Scottrade, the online brokerage, said stock buyers outpaced sellers among its clients for the first 14 trading days of the year, Jan. 3 to Jan. 23. It also said volume was 16 percent higher than December's average.
On Tuesday, the Dow started up 66 points after encouraging signs from Europe that Greece might finally complete a deal to cut its crushing debt, a step toward securing a critical €130 billion bailout payment.
Greece is negotiating with investors who bought its government bonds. They are expected to swap their bonds for new ones with half the face value, plus a lower interest rate and longer term of maturity.
Investors are increasingly worried that Portugal may need a similar deal with its private creditors. European leaders insist the Greek reduction is a one-time event. Portugal's borrowing costs have risen to record highs.
The Dow lost its gains after consumer confidence fell to 61.1 in January, down from 64.8 in December. Economists had expected 68. The Conference Board said Americans are more worried about their incomes, gas prices and business conditions.
There were also signs that the housing market continues to struggle. Home prices fell in November for a third straight month in in 19 of the 20 cities tracked by the S&P/Case-Shiller index. The biggest declines were in Atlanta, Chicago and Detroit.
In the commodities market, investors worried that the confidence figure was a sign of weaker demand to come, and they sold industrial metals that have prices closely tied to the economy.
Copper for March delivery dropped 3.65 cents to $3.79 per pound, and March palladium ended down $2.15 at $686.35 per ounce. April platinum fell $28.20 to $1,588.10 an ounce.
The metals ended the day down after wild swings. Traders bid up prices in morning trading, encouraged by news that European officials were making progress to contain the financial crisis there, then sold hard on the confidence number.
"This is a day that every trader takes Tums," said George Gero, vice president at RBC Global Futures.
Precious metal prices ended the day mixed. The price of gold rose, as it often does when it looks like the economy might shrink or the dollar might lose its value. Gold for April delivery gained $6 to finish at $1,740.40 an ounce.
In the bond market, the weak U.S. economic data and uncertainty about Greece lit up demand for safe investments. The benchmark 10-year Treasury yield dipped to 1.795 percent, its lowest close in almost four months.
The yield on the five-year Treasury note hit a record low for the second straight day, falling to 0.70 percent.
Treasury yields have been falling since last week, when the Federal Reserve said it expected to hold interest rates near zero into late 2014, more than a year longer than its last estimate, because the economic recovery will need help.
In corporate news:
— RadioShack Corp. stock plummeted 30 percent after the company said its profit fell sharply — 11 cents to 13 cents per share for the quarter that ended in December, down from 51 cents a year earlier and less than half what Wall Street was expecting.
— Best Buy Co. Inc., one of RadioShack's competitors, responded by falling 5.6 percent, worst in the S&P. Both companies sell and service cellphones, but demand has softened at their stores.
— Avery Dennison Corp., which makes labels and packaging materials, fell 5.6 percent after it said earnings plunged 81 percent on nearly flat sales. Its 2012 outlook was well below Wall Street expectations.
— Mattel Inc. soared 5 percent because of strong demand for Barbie and Monster High dolls during the holidays. That boosted Mattel's fourth-quarter profit by a better-than-expected 14 percent. The company also raised its dividend.
— U.S. Steel Corp. gained 5 percent after it reported strong demand for pipes from the oil industry from October through December. The company was also optimistic about this quarter.
— Agriculture conglomerate Archer Daniels Midland declined 3.6 percent after it reported an 89 percent drop in quarterly net income. The company said its results were weighed down by weakness in oilseeds, corn processing and agricultural services.
AP Business Writers Stan Choe and Christopher Leonard contributed to this report.