Mr Shalit was captured five years ago and his release was one of the most emotive issues between the two countries.
Although seemingly lopsided, the prisoner swap was agreed with overwhelming cabinet approval in Israel. The breakthrough was also greeted with celebrations in the Gaza Strip.
The breakthrough was brokered by Egypt and a German mediator and although it is not directly related to peace talks, it is hoped that it will improve the overall climate for negotiations.
Hamas leader Khaled Meshaal said that Israel would release 1,027 prisoners in two stages. Within a week, 450 will be swapped for Mr Shalit and the rest, including 27 women, will be freed two months later.
Israeli Prime Minister Binyamin Netanyahu said that Mr Shalit would be reunited with his family “in the coming days”.
“I believe we have reached the best agreement possible at this time, when storms are raging in the Middle East,” he said. “It’s possible that this window of opportunity would have closed for good and we never would have brought Gilad home.”