SINGAPORE - The dollar was headed for a second straight quarterly gain and jumped to a near four-decade high on the battered yen on Friday as traders tentatively tested Japan's resolve to defend its currency, while waiting on crucial U.S. inflation data.

Republican U.S. presidential candidate Donald Trump unleashed a barrage of at-times false attacks on President Joe Biden in their first campaign debate in Atlanta, with the dollar rising as Biden stumbled over his words a few times in early exchanges.

The yen hit 161.27 per dollar, its weakest since 1986 and the euro dipped 0.1% and was last at $1.0693. The Australian and New Zealand dollars dropped about 0.2% each, last buying $0.6631 and $0.6068 respectively.

"Biden came across poorly," said Jason Wong, market strategist at BNZ in Wellington.

That increased the odds of a Trump presidency and import tariffs, he said, noting traders were buying dollars but moves were fairly modest.

The dollar index equalled Wednesday's eight-week high of 106.13 and has logged a 1.5% rise for the quarter so far.

It is the second quarterly gain in a row as markets have trimmed expectations for U.S. rate cuts over the past six months. The Federal Reserve's preferred inflation measure, the personal consumption expenditures (PCE) index, is due later on Friday. If its annual growth slowed to 2.6% in May, as economists expect, it may open the way to cuts later this year.

Sterling was flat on Friday at $1.2633 and broadly steady for the quarter as markets looked to Britain's general election next week and to whether Labour - if it wins an expected landslide - can revive the stagnant economy.

The quarter's biggest loser has been the yen, down 6% on the dollar since the end of March and more than 12% in 2024 so far.

At 172.38 per euro it touched a record low on the common currency early on Friday. Core inflation in Japan's capital accelerated in June, data showed on Friday, though that did little to support the yen.

Low Japanese interest rates have encouraged selling yen for higher-yielding currencies even as Japanese yields have started to rise and officials have warned of another round of currency intervention.

Japan replaced top currency diplomat Masato Kanda on Friday with financial regulation expert Atsushi Mimura. Finance Minister Shunichi Suzuki said authorities were "deeply concerned" about the impact of "rapid and one-sided" yen moves.

"After we broke 160 (per dollar without intervention), what's next? I think that's what markets are wondering," said Bank of Singapore strategist Moh Siong Sim. "When are they going to show their hand, if they're not going to show their hand at 160?"

(Reporting by Tom Westbrook; Editing by Jacqueline Wong and Jamie Freed)