Japan's longest-serving premier, Prime Minister Shinzo Abe, has announced he will resign over health problems, in a development that kicks off a leadership contest in the world's third-largest economy.

"I have decided to step down from the post of the prime minister," he told a press conference, saying he was suffering from a recurrence of the ulcerative colitis that ended his first term in office.

Speculation about the prime minister's health has been mounting for weeks but increased further in recent days after he made two separate trips to hospital for unspecified medical checks.

Mr Abe took three days of holidays this month and on 17 August made an unannounced hospital visit, staying there for more than seven hours for medical checks.

He made a second visit to the same hospital a week later for additional tests and said at the time that he intended to continue in the job.

The resignation will trigger a leadership race in the ruling Liberal Democratic Party - most likely in two or three weeks - and the winner must be formally elected in parliament.

The new party leader will hold the post for the rest of Mr Abe's term.

Whoever wins the party poll is likely to keep Mr Abe's reflationary "Abenomics" policies as Japan struggles with the impact of the coronavirus, but may have trouble emulating the political longevity that may be Mr Abe's biggest legacy.

On Monday, Mr Abe surpassed a record for longest consecutive tenure as premier set by his great-uncle Eisaku Sato half a century ago.