Mr Abe has had ulcerative colitis for years – a long-term condition where the bowel becomes inflamed – and said his health had declined around the middle of last month.
Two recent hospital visits within a week fanned questions on whether he could stay in the job until the end of his term as ruling party leader, and hence, premier, in September 2021.
In a news conference the 65-year-old PM said: I cannot be prime minister if I cannot make the best decisions for the people. I have decided to step down from my post.
It is gut-wrenching to have to leave my job before accomplishing my goals. His departure marks the end of an unusual era of stability that saw the Japanese leader strike up strong ties with President Donald Trump even as Mr Abe’s ultra-nationalism riled the Koreas and China.
While he pulled Japan out of recession, the economy has been battered anew by the coronavirus pandemic, and Mr Abe has failed to achieve his cherished goal to formally rewrite the US-drafted pacifist constitution because of poor public support.
The resignation will trigger a leadership race in the Liberal Democrat Party (LDP), the winner of which must be formally elected in parliament.
Mr Abe did not give any hints as to who his successor could be but media reports suggest Shigeru Ishiba, a 63-year-old former defence minister and the PM’s arch-rival, could be the favourite.
The new party leader will hold the post for the rest of the PM’s term.
Boris Johnson tweeted his best wishes following Mr Abe’s announcement: “Shinzo Abe has achieved great things as PM of Japan – for his country and the world. Under his stewardship the UK-Japan relationship has gone from strength to strength in trade, defence and our cultural links. Thank you for all your years of service and I wish you good health.”
On Monday, he surpassed a record for longest consecutive tenure as premier set by his great-uncle Eisaku Sato half a century ago.
Mr Abe has acknowledged having ulcerative colitis since he was a teenager and has said the condition was controlled with treatment.
After his hospital visits were reported, top officials from his cabinet and the ruling party said the leader was overworked and badly needed rest.
Mr Abe resigned from his first stint as prime minister in 2007, citing ill-health after a year plagued by scandals in his
cabinet and a huge election loss for his ruling party. He had since kept his illness in check with medicine that was not previously available.