The Christmas shopping season proved the best in nearly two years for the nation's largest general retailers with most stores posting strong December sales gains.

"It turned out to be a good Christmas," Jeffrey Edelman, a retail industry analyst with the investment firm Drexel Burnham Lambert Inc., said. "Sales were better than we expected," Edelman said.Analysts estimated industrywide sales rose in a range of 6 percent to 7.5 percent, an improvement over the 6 percent gain forecast before the start of the season.

Despite the strong showing in December, many retailers have had trouble keeping up with inflation over the course of fiscal 1988. Inflation grew at a rate of 4.4 percent for much of the year.

Jeffrey Feiner, an analyst with Merrill Lynch & Co., said the tone of business was vastly improved over the disappointing Christmas 1987 season, when retailers were forced to slash prices in order to lure customers. This year, there were fewer markdowns, he said.

Feiner predicted retailers would post earnings increases of 10 to 15 percent for the fourth quarter. The final quarter is crucial for retail companies because they generally earn half their annual profits during this period.

Strong gains were evident in all segments of the industry, even at the higher end of the economic scale. Neiman-Marcus Group Inc. said sales at its stores open at least a year - known as same-store sales in the industry - were up a strong 12.2 percent from December 1987.

And apparel retailers continued their comeback from a year-long sales slump. Limited Inc., a leading clothing retailer, said its same-store sales soared 28 percent.

Analysts said the industry benefited from changes in the calendar, which added two days to the shopping season this year. But they also said consumers - who had spent cautiously for nearly two years - appeared more confident about the economy and their finances.

However, industry watchers were split over whether the spending surge would continue into 1989.

Consumer spending is watched as a barometer of economic health because it accounts for two-thirds of the gross national product. Since early 1987, retail sales have been in a slump because consumers were paying more for services and necessities such as food and cars.

Sears, Roebuck and Co., the nation's largest retailer, said its overall December sales rose 12.1 percent, while its sales for the cumulative 48 weeks were up 7.1 percent. Sears' same-store sales were up 8.4 percent for the month and 3.2 percent for the year to date.

Retailers and industry analysts believe same-store sales are a more accurate measure of a company's performance than figures that include sales from new stores. Not all retailers report same-store sales.

K mart Corp. said its overall sales were up 10.7 percent for the month, and 6.5 percent for the year to date. Same-store sales rose 6.8 percent last month and 2.8 percent so far this year.

J.C. Penney Co. Inc. said its overall sales fell 1.5 percent for the month and 0.2 percent for the 48 weeks. Same-store sales were down 3.6 percent in December and 1.7 percent for the year to date.