WASHINGTON (AP) -- Rising gasoline costs pushed up the prices U.S. companies receive for their goods and services in June, but overall inflation remains tame.

The Labor Department said Wednesday that the producer price index, which measures the cost of goods and services before they reach the consumer, rose 0.4% last month. The increase follows a 0.2% decrease in May.

Gas costs rose 6.4% in June. Steel prices shot up 3%. But prices fell for grains, cheese and rental cars to offset some of those increases.

In the past 12 months, producer prices have risen 1.9%, roughly in line with the Federal Reserve's inflation target of 2%.

Consumer prices have tended to track the costs for producers. They rose in May in response to food and energy costs increasing earlier in the year for wholesalers. Consumer prices rose 2.1% in May compared to the year prior.

Retailer and wholesaler profit margins increased 0.2% in June. Excluding the volatile food, energy and profit margin categories, core producer prices were up 0.2% last month.

The Fed targets inflation at about 2% as a guard against deflation, which can drag down wages and spark a recession. At the same time, the Fed wants to avoid excessive inflation and protect consumers and the purchasing power of the dollar.

Low inflation should provide a foundation for consumers to spend, but it also reflects the weak recovery from the Great Recession that is now entering its sixth year. Businesses are reluctant to raise their prices, if their customers lack the income to afford their goods and services.

Wage growth has been meager and unemployment, now at 6.1%, has been slow to recede since the recession. That has limited consumer spending, which accounts for about 70% of all economic activity.

Still, low inflation has enabled the Fed to pursue extraordinary measures to boost the economy. This includes holding shorter-term interest rates near zero and purchasing bonds to depress longer-term interest rates. It has begun to unwind some of those measures, cutting its monthly bond-buying program to $35 billion from $85 billion last year.

Those bond purchases had ensured low interest rates that encouraged investors to pour money into the economy.

The Motley Fool recommends Apple. The Motley Fool owns shares of Apple. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.