After a debate that dragged on for eight hours on Sunday, the cabinet voted 12-11 in favour of the swap supported by Sharon, reported Israeli media.
Some 400 jailed Palestinians and Lebanese are to be exchanged for an Israeli reservist colonel Elhanan Tannenbaum and three soldiers captured by Hizb Allah in October 2000.
It was not immediately clear when or where the exchange would take place.
But in a move that is likely to delay any exchange, Lebanese prisoner Samir al-Qantar, whose release was demanded by Hizb Allah, was excluded from the deal, said Housing Minister Effi Eitam.
Al-Qantar was condemned to 542 years in prison for the 1979 killing of an Israeli family.
Ansaf Yasin, whose brother Anwar was captured 17 years ago following an anti-occupation attack, is giddy with exhilaration.
“I can’t describe how happy we are,” she said, as a chatter of excitement buzzes in the background. The family was celebrating after hearing news that Israel had agreed to a prisoner swap.
“But we will not accept to have some prisoners released and others remain,” she said firmly, in reference to al-Qantar.
“Although I want Anwar released as soon as possible, it’s all or nothing,” adding families of the detainees would hold a demonstration in downtown Beirut for the release of all prisoners.
“(Hizb Allah Secretary General Sayyid) Nasr Allah has never said anything and then backed down”
Lebanese detainee Samir's brother
Bassam al-Qantar, Samir’s brother, said Hizb Allah called his family immediately following Israel’s statement, reassuring them that no exchange would take place without Samir.
“I think this Israeli decision will break off all negotiations with Hizb Allah because Sayyid Hasan Nasr Allah was very clear yesterday when he said there would be no prisoner exchange without Samir,” said the political science student, 26.
“Nasr Allah has never said anything and then backed down,” he added.
Bassam was 15 months old when his oldest brother was arrested on 2 April 1979. His father passed away in 1986. For years, his mother, four sisters and brother waited for Samir’s release.
In recent weeks, the family has experienced some of the strongest flickers of optimism as Hizb Allah and Israel indicated talks were about the most productive in their history.
The swap had met with opposition within Israel over Sharon's willingness to release the prisoners without receiving in return information about the fate of Ron Arad, a missing Israeli airman whose plane was shot down over Lebanon in 1986.
Arad has become a national icon in Israel and his family has mounted a public campaign accusing Sharon, a former general, of effectively abandoning a soldier on the battlefield.
Ron Arad: Missing
Sharon has said failure to approve the swap could mean death for Tannenbaum.
The three soldiers were captured from the occupied Shebaa Farms. Israel now believes they are dead while the resistance group has refused to clarify their fate.
As for Tannenbaum, Hizb Allah says he is a Mossad agent. Israel says he is a businessman lured to Abu Dhabi for what he believed would be a lucrative business deal.
Israel is also expected to release prominent Hizb Allah leaders Shaikh Abd al-Karim Ubaid and Mustafa Dirani, kidnapped by Israel as bargaining chips in exchange for Arad.
Before the cabinet meeting on Sunday, Sharon had lacked a majority.
Israel’s security apparatus was split over the swap, with the army and military intelligence services in favour while the external and internal security services, Mossad and Shin Beth, opposed to it.