Soaring energy prices after Iraq's invasion of Kuwait pushed Americans' cost of living up 0.8 percent in September, the second consecutive monthly dose of bad inflation, the government said Thursday.

The September rise matched the August increase in the Labor Department's Consumer Price Index. If prices continued rising at that pace for a year, it would produce an annual inflation rate of 9.5 percent.The pickup in inflation this year translated into the biggest boost in Social Security benefits in 8 1/2 years. Based on Thursday's CPI report, the government announced a 5.4 percent rise in benefits beginning in January for the 40 million Social Security recipients.

In addition to boosting inflation, the Iraqi invasion had a detrimental effect on the nation's merchandise trade deficit, which jumped 2.4 percent in August as rising oil prices pushed imports to a record high.

The gap between imports and exports climbed to $9.3 billion, the largest since January.

In the inflation report, energy prices in September jumped 5.6 percent, the worst rise on record since the department began tracking the sector in 1957.

Gasoline soared 9.5 percent, the worst in 17 months, and fuel oil rose 15.9 percent. For August and September together, gasoline rose 17.9 percent and fuel oil was up 33.7 percent.

Electricity and natural gas charges also rose, but less steeply.

For the first nine months of the year, consumer prices advanced at an annual rate of 6.6 percent, well above the 4.6 percent increase for all of 1989.

Analysts expect the bad news to continue through November or December, even if oil prices stabilize near $40 a barrel, double the July price. The oil shock will begin feeding through to chemicals, airline tickets and other energy-related products and services.

The bite out of consumers' wallets is expected to slow an already sluggish economy.

"We're going into a recession, very clearly," said economist David Wyss of DRI-McGraw Hill.

Prices excluding energy rose a more moderate 0.4 percent in September, the same as the previous month.

"While prices in most components of the index accelerated, the run-up for petroleum-based energy prices has had the largest effect," it said in its release.

Medical care was up 0.7 percent, bringing prices 9.3 percent higher than a year earlier.

Clothing costs were up 0.7 percent in September. Men's and boys' clothing prices fell, but women's, girls' and infants' clothing costs rose, as did the price of shoes.

On a positive note, food prices rose 0.3 percent, the same as last year. New car prices edged up only 0.1 percent after remaining unchanged in August. Car dealers beset with lagging sales have been unable to wean the public from rebate programs and discounted financing.

Housing costs were up 0.4 percent, held back by a decline in hotel and motel costs, which had been rising steeply earlier in the year.

The various changes put the index for all consumer goods at 132.7 in September. That means that a hypothetical selection of goods and services costing $100 in the 1982-84 base period, cost $132.70 last month, up $7.70 from a year earlier.

As bad as the short-term inflation outlook seems, analysts expect inflation to return to normal next year, unless a shooting war breaks out in the Gulf.

Previous oil shocks in 1973 and 1979 helped feed an inflationary psychology that sent prices higher for a variety of goods and services with little connection to energy.