Khalil Awawdeh, a father of four, was at risk of death and was already suffering neurological damage as a result of the hunger strike, lawyers and physicians had warned.
In a video apparently filmed from his hospital bed in Rishon LeZion city on Wednesday, Mr Awawdeh, 40, called the agreement securing his release a “resounding victory” for the Palestinian people.
Mr Awawdeh's hunger strike was a protest against being held without charge or trial, a practice known as administrative detention.
The Commission of Detainee Affairs, part of the Palestine Liberation Organisation, said Mr Awawdeh had reached an agreement that would see him released on October 2 “after fighting an epic battle for which he sacrificed his flesh and life”.
The Israeli military, the prison service and the Defence Ministry declined to comment. The Shin Bet internal security service did not respond to a request for comment.
Israel has said administrative detention is needed to keep dangerous militants off the streets without revealing sensitive intelligence.
However, Palestinians and rights groups have argued that it denies detainees the basic right of due process.
In the video, Mr Awawdeh said he would remain in an Israeli hospital until he has fully recovered. He thanked those who supported him and prayed for him.
Israel accuses Mr Awawdeh of being a member of the Islamic Jihad militant group, an allegation he denies.
The group demanded his release as part of the ceasefire deal that ended three days of heavy fighting in Gaza earlier this month, but did not identify him as a member.
Ahlam Haddad, Mr Awawdeh’s lawyer, said this week that his client weighed only 37 kilograms and was suffering from neurological damage.
He took vitamins over two weeks in June when he thought his case was being resolved but had, otherwise, only had water since the strike began in March, his family says.
Israel officially suspended his detention but he remained in custody at an Israeli hospital.
Hundreds held by Israel
Several Palestinians held by Israel have gone on prolonged hunger strike in recent years to protest against administrative detention.
In most cases, Israel has released them after their health deteriorated significantly. None have died in custody but many have suffered irreparable neurological damage.
Israel is holding 743 administrative detainees, the highest number since 2008, according to Israeli human rights group HaMoked, which tracks the number using official figures obtained through freedom of information requests.
The number of administrative detainees has shot up in recent months as Israeli forces have carried out night raids in the occupied West Bank after a series of deadly attacks against Israelis earlier this year.
Nearly all administrative detainees are Palestinian, as the practice is rarely used with Jewish detainees.
“Administrative detention should be a rare, exceptional measure, but it is standard practice in Israel’s treatment of Palestinians, with hundreds of people held for months at a time, without charge or trial, solely on the basis of secret information,” said Jessica Montell, the director of HaMoked.
“All of these detainees should be given a fair trial or released immediately.”
Israel is currently holding about 4,400 Palestinian prisoners, including militants who have carried out deadly attacks and people accused of taking part in protests or throwing stones.