TOKYO — Japan's trade deficit rose nearly 10 percent in May to 993.9 billion yen (nearly $10.5 billion), highlighting the challenge Prime Minister Shinzo Abe faces in revitalizing manufacturing as industries increasingly shift production offshore.

Rising costs for imports due to the cheaper yen matched a 10 percent rebound in exports from a year earlier, the Finance Ministry reported Wednesday.

A weakening in the yen's value has pushed up costs for imports of crude oil, natural gas and other commodities for this resource-scarce nation, but the deficit in May was bigger than most economists' estimates.

Strong growth in exports to the U.S., China and the rest of Asia were offset by even stronger imports from the Middle East and China.

While robust imports suggest that demand inside Japan is recovering, growing deficits show that Japan's trade environment has changed for good, said Eiji Ogawa, an economist at Hitotsubashi University in Tokyo.

"Just a while ago, Japan always enjoyed a surplus," Ogawa said at a conference Wednesday. "It's now clear the deficits are not temporary, but structural."

Japan's economy grew at a 4.1 percent annual rate in the first quarter of the year and is forecast to continue its recovery this year, boosted by government stimulus spending and aggressive monetary easing aimed at ending two decades of stagnation.

But sustained growth will depend on getting Japan's cash-rich corporations to do more hiring and spending at home — a tough sell given the rapid aging and shrinking of the Japanese population.

The May data show Japan's efforts to boost trade with the rest of Asia are yielding results, with exports rising 11 percent to 3.2 trillion yen ($33.7 billion), as imports climbed nearly 10 percent to 2.98 trillion yen ($31.4 billion).

Exports to China rose 8.3 percent in May from a year earlier to 1.05 trillion yen ($11 billion) while imports jumped 15 percent to 1.46 trillion yen ($15.4 billion), leaving a deficit of 410 billion yen ($4.3 billion).

Increasingly, Japanese companies are expanding their manufacturing in Southeast and South Asia, partly to tap new, faster growing markets and partly to hedge risks from their already huge commitments in China, given the threat of anti-Japanese moves due to a festering territorial dispute with Beijing.

Economists say Abe must move ahead with promised tax cuts and deregulation to spur investment and hiring by corporations that complain inflexible labor laws and high taxes and wages are hurting their competitiveness.

"Companies believe it's better to produce overseas and repatriate the profits," Ogawa said, adding that a weakening of the yen helps, but can only provide a temporary respite from what the Japanese call the "hollowing out" of their industrial base.

"Shifts in foreign exchange rates won't bring factories back to Japan," he said.

The yen has slid in value by more than 20 percent against the U.S. dollar and euro since late last year, in turn pushing up other currencies in relative value. Its decline is due to expectations among market speculators and also the monetary policies that are injecting huge sums of cash into the economy.

On Wednesday the dollar was trading at a level of about 94.5 yen.

Japan's trade surplus with the United States jumped 26 percent over the year before to 427.1 billion yen ($4.5 billion). Exports surged 16.3 percent year-on-year to 1.04 trillion yen ($10.9 billion) and imports rose 10 percent to 614 billion yen ($6.5 billion). But exports to the EU fell 5 percent, while imports jumped nearly 9 percent, boosting Japan's deficit by nearly 650 percent, to 88.7 billion yen ($933.7 million).

Overall, exports rose 10.1 percent in May over a year earlier to 5.77 trillion yen ($60.7 billion) while imports also surged 10 percent, to 6.76 trillion yen ($71.1 billion), according to the preliminary data from the Finance Ministry.

Japan's trade deficit in May 2012 was 907.93 billion yen, while its deficit in April was 879.9 billion yen.

Much of the deterioration in the trade balance is attributed to a surge in demand for oil and natural gas after most of Japan's nuclear power plants were closed following the March 2011 accident at the Fukushima Dai-ichi plant. Mounting costs for imported fuel are buttressing the pro-nuclear government's case for restarting more plants.

In May, imports from the Middle East, primarily of crude oil and gas, jumped 11.5 percent from a year earlier to 1.23 trillion yen ($12.9 billion).

While many argue that Japan needs to just shift faster and more aggressively into renewable energy, others say that nuclear energy is essential for Abe's policies to succeed, since companies say high energy costs are a factor driving them offshore.

"Given Japan's limited natural resources ... it will be necessary to rely on nuclear power for at least some years," said Masayuki Kichikawa, an economist at Bank of America-Merrill Lynch in Tokyo.

"That is very important for keeping many companies in Japan," he said. "To ensure a stable source of energy is very important."