TOKYO — Japan said Thursday that it had intervened in the foreign exchange market, selling yen and buying dollars in a bid to reverse a punishing spike in the value of the Japanese currency.

Japan has been desperate to bulwark its fragile recovery from the March earthquake and tsunami. But even as companies have raced to repair damaged factories and resume production, they have been hit by a surge in the yen that threatens their business overseas.

A strong yen hurts Japan’s export-led economy by making its cars and electronics more expensive overseas, and by eroding the value of overseas earnings when converted into yen.

But the Japanese currency, long considered a safe haven, rose as investors wary of the debt impasse in the United States fled to other currencies. Against the dollar, the yen has surged about 11 percent in the last year, and 4 percent in the last month.