The nation's major retailers yesterday reported only modest sales gains for the last 12 months, but they recorded a surge in consumer spending that began the week before Christmas and continued in January.

Analysts said the strong sales increases retailers reported for January were in part related to mild weather as well as heavy promotional sales. But analysts said the figures also showed a renewed willingness by consumers to spend money on general merchandise, especially on the part of better-heeled customers.

"It's an early sign of an economic recovery," said Monroe H. Greenstein of the brokerage firm Bear, Stearns Inc.

Department stores and specialized retailers did better, both for January and for the year, than did mass merchandisers. But January sales gains for nearly all retailers were the best since summer, when a worsening recession prompted many to keep their wallets in their pockets.

Sears, Roebuck & Co., for example, said its sales for the 12 months ended Jan. 31 rose 2.6 percent, from $19.67 billion to $20.18 billion. But the nation's biggest retailer said its January sales were $1.26 billion, 5.5 percent higher than in January 1982.

At Federated Department Stores, Inc., the fifth-largest retailer and owner of the fashionable Bloomingdale's chain, 12-month sales rose 10 percent, from $7 billion to $7.7 billion, while January sales surged 16 percent to $480.3 million from $413.3 million.

Analysts said most of the nation's retailers are likely to report increases in profits as well, even with the promotions and sales that began long before Christmas.

Greenstein said that despite the massive discounting retailers have done to lure reluctant consumers, merchandisers were able to maintain their profit margins. Most of the costs of the sales were borne by suppliers rather than the retailers, he said.

"Any profits surprises this year will be on the up side," Greenstein said.

But analysts cautioned that the sharp sales gains in January are not likely to be repeated in February, even if consumers continue to step up their buying.

Severe January weather in many parts of the country last year forced retailers to close down or curtail hours and kept many consumers home. As a result, some of the heft in January 1983 sales increases was due to depressed January 1982 sales.

Jeffrey Edelman, an analyst with the brokerage firm Dean Witter Reynolds, also cautioned that January is a relatively insignificant sales month. Still, he said, retail sales were "better than expected."

Other major retailers reporting yesterday included:

* K mart, the second-biggest, which showed a 1.5 percent, 12-month sales gain, to $16.77 billion from $16.53 billion. January sales rose 2 percent. Analysts said K mart's 1982 sales held up better than most retailers.

* J. C. Penney, which had a 2 percent, 12-month gain, from $10.17 billion to $10.36 billion. For January, sales rose 9.2 percent, to $569 million from $521 million.

* F. W. Woolworth Co., which reported a 4.5 percent sales gain for the 12 months, from $7.2 billion to $7.5 billion. In January, the chain's sales jumped 32.4 percent, but much of it was due to close-out sales at the company's Woolco stores, which have gone out of business.

* Montgomery Ward, which had a one-year sales decline of 1.1 percent to $5.62 billion from $5.68 billion. The subsidiary of Mobil Corp. said January sales rose 12.3 percent.

* Dayton-Hudson Corp., which showed a 14.3 percent increase in 12-month sales, to $5.53 billion from $4.84 billion, and a 27.5 percent January gain.

* May Department Stores, which reported its 12-month sales rose 7.4 percent to $3.65 billion from $3.4 billion and a January sales increase of 17 percent.