Inflation returned with a vengeance last month to prices charged by producers of finished goods, as oil prices turned back up and consumer food prices registered their biggest increase in six months, the Labor Department reported yesterday.

Meanwhile, the Federal Reserve said that industrial production tumbled 0.6 percent last month. That decline left the output of the nation's factories, mines and utilities virtually unchanged from its level a year ago and about 2 percent lower than in January.

The finished-goods price index jumped 0.6 percent in May following four consecutive monthly declines that averaged 1 percent. The energy portion of the index rose 2.7 percent in May, as gasoline prices climbed 8.6 percent. Consumer food prices increased 1.1 percent, the department said.

The increases in volatile energy and food prices was not seen by most analysts as signaling a return to high inflation. Rather, they expect producer prices to rise only modestly once oil prices stabilize.

The consumer price index, which also has been falling recently, is expected to go up more rapidly than the producer price indexes. That is because service prices, which already are rising at about a 5 percent rate, are not included in the latter.

Despite the unfavorable economic news, the stock market soared yesterday. The Dow Jones industrial average showed its eighth-largest gain, jumping by 36.06 points to 1,874.19. Traders said stock prices climbed because investors believe the economic statistics mean the Federal Reserve will have to cut interest rates to stimulate the economy.

The declines in industrial production were widespread, but particularly sharp in motor vehicles, business equipment, oil and gas well drilling and durable-goods-materials industries, the Fed said. Revisions of figures reported for the prior three months showed large 0.9 percent declines for February and March and a 0.4 percent increase for April.

Analysts said the reports issued yesterday -- along with those released earlier covering employment, retail sales and business intentions to invest in new plants and equipment -- are evidence that the economy is growing less rapidly than it did in the first quarter.

The gross national product, adjusted for inflation, rose at a 3.7 percent annual rate in the first three months of the year. Many forecasters think it is increasing at a pace of only 2 percent or so this quarter.

Nevertheless, most forecasters expect a significant acceleration in economic activity in the second half of the year. They point to lower interest rates, an apparent slight improvement in the U.S. trade deficit following the big decline in the value of the dollar on foreign exchange markets, and substantial gains in real household income as a result of declining prices as all indicating that economic growth should begin to pick up soon.

White House spokesman Larry Speakes termed the increase in finished-goods prices "a modest uptick" and predicted that it will be temporary. ". . . Since the price of crude has dropped back below the $15-a-barrel level in June, we expect only modest increases in producer prices over the summer months," he said.

The Commerce Department yesterday released figures for business inventories and sales for April also suggesting that the rise in GNP this quarter will be modest. Inventories of manufacturers, retailers and merchant wholesalers, which rose substantially in the first quarter, rose only slightly in April, the report said.

But much of the inventory accumulation in the first quarter was involuntary, and new orders for goods have not been rising significantly with so many items already on hand. Once the inventory overhang has been worked off, orders should increase, followed by a rise in industrial production.

Lyle Gramley, chief economist of the Mortgage Bankers Association of America, said the various developments that are apt to produce a poor GNP number this quarter are at the same time setting the stage for faster economic growth over the next 18 months. "I think the second quarter will be the last quarter of sluggish growth," he said.

Despite the 0.6 percent increase in the producer price index for finished goods in May, the index is 1.7 percent lower than it was in May 1985. After increasing 8.6 percent last month, gasoline prices were still down 34.3 percent in the past year, while home heating oil prices, which continued to fall in May, were down 42.1 percent.

A separate index for prices of intermediate materials such as flour, synthetic fibers and electric power fell 0.2 percent last month following a 1 percent drop in April. Crude-goods prices rose 2.3 percent in May, primarily as a result of higher prices for foodstuffs and feed. That index fell 3.6 percent in April.

Explaining the drop in industrial production, the Federal Reserve said that auto manufacturers, faced with unwanted inventories, slowed their pace of assembling new cars to a 7.6-million-unit annual rate in May from an 8.1-million-unit rate the month before. Production of other durable consumer goods also fell, and production of nondurable consumer goods was unchanged.

Production of business equipment declined 1.1 percent in May and was down 2.2 percent in the past 12 months, the Fed said. New orders for such equipment have been languishing, and the results of the latest Commerce survey of business investment intentions, released Thursday, suggested why.

After adjustment for inflation, businesses plan to spend about 1.3 percent less in 1986 for capital investments than they did in 1985, the survey found. Much of the weakness in capital spending is related to the big drop in crude-oil prices, which in May were 51.6 percent lower than they were a year earlier, and to large amounts of unused production capacity in manufacturing industries, analysts said.

Gramley said that the faster growth, which he expects to begin soon, will be primarily a consequence of strong gains in consumer spending and new housing construction and a steady improvement in the nation's trade balance. "The weakness in capital spending will be there for a while," he said.