U.S. import prices inched up in August as oil prices rose sharply for a third straight month, the government said on Thursday.

Import prices increased 0.2 percent last month, compared to a gain of 0.5 percent in July, the Labor Department said. Economists polled by Reuters expected import prices to rise 0.4 percent.

A 3.9 percent rise in petroleum imports accounted for all of August's import price rise. The cost of non-petroleum imports actually fell by 0.2 percent, the department said.

The report showed a 0.1 percent drop in export prices. Wall Street economist had expected export prices to edge up 0.1 percent.

Over the past 12 months, import prices have risen 2.1 percent, but much of the gain reflects rising oil prices. Excluding oil, import prices are up just 0.8 percent.