The U.S. economy expanded at a 4.5 percent annual rate from October through December, the fastest pace in almost two years, the government reported yesterday.

The growth in the gross national product, the broadest measure of the economy's health, was revised up from an original estimate of 4.2 percent made a month ago.

The Reagan administration said the growth rate showed that the economic recovery -- now in its sixth year, a record for peacetime -- was suffering no ill effects from the October stock market collapse. However, private economists said they were still concerned about the lopsided nature of the growth.

The rapid expansion in the fourth quarter occurred without a pickup in inflation. A price index tied to the GNP rose at an annual rate of 3.7 percent from October through December, little changed from a 3.4 percent increase in the third quarter.

Three-fourths of the growth last quarter came from a buildup of business inventories occurring at the same time that consumer spending was plunging 3.1 percent, the biggest spending drop in more than seven years.

The last such sharp drop in consumer spending occurred in 1980 during the brief recession that year, which helped doom President Jimmy Carter's reelection bid.

Many economists believe that growth will slow substantially in the first half of this presidential election year, but they are not forecasting a recession.

Some analysts said the revisions made in the new GNP report made them more confident that a recession can be avoided.

"As we move into 1988, there has to be a slowdown to work off excessive retail inventories, but it will be a pause and not a recession," said Allen Sinai, chief economist of the Boston Co., an investment firm.

Analysts said the GNP report showed that consumer spending, while falling sharply, was not as weak as previously believed. The report also increased the estimate of business investment spending, another area of expected strength in the new year.

On the basis of the revised GNP figures, Sinai said he had boosted his estimate of growth in the current quarter to between 1 percent and 2 percent, up from an earlier prediction of growth as low as 0.5 percent.

The 4.5 percent increase in economic growth followed a gain of 4.3 percent in the third quarter and was the fastest advance since a 5.4 percent rise in the first quarter of 1986.

The fourth-quarter gain boosted growth for the year to 3.9 percent, when measured from the end of 1986, up slightly from the 3.8 percent estimate a month ago. Growth when all four quarters of the year are averaged together showed a 2.9 percent increase in 1987, the same as 1986.

The Reagan administration is forecasting that growth this year will slow to a rate of 2.4 percent. Many private economists believe even this scaled-down figure is too optimistic given the huge overhang of inventories that will slow production in the early part of the year.