BOSTON – There’s another sign that investors’ confidence is returning: Last month they added money to U.S. stock mutual funds at the fastest clip in seven years. The year-opening surge also marked the first time in nine months that investors added more than they withdrew.

All told, investors deposited a net $21.3 billion to U.S. stock funds in January, the biggest monthly increase since a net inflow of $23 billion in February 2004, industry consultant Strategic Insight said Friday.

Last month’s surge also snapped a string of net withdrawals that began in May. The last time there was a positive inflow of cash into domestic stock funds was April, when a net $11 billion came in.

Investors soon reversed course after the stock market’s May 6 “flash crash” single-day plunge. Fears about Europe’s government debt crisis also peaked that month.

But the stock market has now risen five consecutive months, and the Standard & Poor’s 500 index is up about 26 percent since Sept. 1. Corporate earnings are approaching record levels, and most economic indicators suggest the recovery is gaining momentum.

“The interest in stocks is being shored up by a new year, and stock prices which have doubled since their bottom in early 2009,” said Avi Nachmany, research director with New York-based Strategic Insight.