Driven by mortgage interest rates and other housing costs, the consumer price index rose at an annual rate of 8.4 percent last month, the Labor Department said yesterday.

Health care costs and new car prices also rose sharply. But gasoline and grocery store prices both fell.

The price increases were matched by rising wages, so that the purchasing power of an average hour's work remained the same, the department reported. In the last year this purchasing power has fallen 0.3 percent.

The department said in a separate report that consumer prices in the Washington metropolitan area rose 0.9 percent in April and May combined, only about half as much as nationally. Food prices locally fell an extraordinary 5.1 percent for the two months, reflecting the area-wide supermarket price war.

For the country as a whole, the department reported that consumer prices rose 0.7 percent last month after seasonal adjustment. That was up from the 0.6 and 0.4 percent recorded in March and April, when it seemed inflation was receding. It lifted the price index for all urban consumers to 269, meaning it costs $269 last month to buy a basket of goods and services that cost $100 in 1967.

But the index for all items was only 9.8 percent higher than a year ago, the first time since early 1979 that consumer prices have risen at less than a double-digit rate of 10 percent or more in a 12-month period. High interest rates are now helping to retard economic activity and reduce demand.

Partly because of this, economists in and out of the administration expect the inflation rate to decline somewhat in the months ahead. "Double-digit inflation as a phenomenon is behind us," Chairman Murray Weidenbaum of the Council of Economic Advisers was quoted as saying yesterday.

Jerry Jordan, who has been nominated to be a member of the CEA, also said at his Senate confirmation hearing yesterday that interest rates and inflation have reached their cyclical highs.

The Labor Department said grocery store prices, which fell 0.5 percent last month, were up 8.6 percent for the year. Fresh fruit and vegetable prices fell in May; so did sugar and dairy product prices. But beef prices rose slightly.

Housing costs were up 10.2 percent for the year ended in May, medical care costs 9.7 percent, transportation costs 11.6 percent. New car prices rose 2.4 percent in May on top of 1.8 percent in April; in part this reflected the end of the spring rebate programs by domestic manufacturers.

Gasoline prices fell 1.5 percent in May, the second such monthly decline in a row. Gasoline prices spurted when President Reagan lifted price controls from U.S. crude oil earlier this year; then they fell back. In part because of a world oil glut. They now are 10.9 percent higher than 12 months ago.

Housing costs, which rose 1.3 percent in May, were responsible for about four-fifths of the increase in the all-items index for the month. Mortgage interest rates were the chief villain; they rose 2.1 percent. House prices rose 0.9 percent and rents 0.8 percent. The housing component of the consumer price index has been much criticized of late, partly on grounds it gives too much weight to changes in mortgage interest rates, which most homeowners do not feel.