Jubilant supporters waved flags and cheered outside Chaudhry's home in Islamabad, the Pakistani capital, and he briefly made an appearance on the balcony.
The boisterous crowd saw Chaudhry's reinstatement as a capitulation by the government in the face of sustained campaigning by lawyers and opposition workers, seeking an independent judiciary.
Tariq Mehmud, a retired judge and a leader of the lawyers' campaign, said it was a "victory for those who fought for independence of judiciary".
'Beginning of Zardari's end'
Chaudhry, the former supreme court justice, was dismissed by Pervez Musharraf, the former president, on November 3, 2007 along with 60 other judges, when Musharraf declared emergency rule in a move to extend his presidency for another term.
Most of the judges had since been reinstated since Zardari took over as the president six months ago.
But Zardari repeatedly reneged on election promises to return Chaudhry to his post with analysts suggesting that he feared the chief justice could pose a threat to his position.
Al Jazeera's Zeina Khodr, reporting from outside Chaudhry's residence, said the "decision really has defused tensions and averted a political showdown".
"A lot of Pakistanis will say that this is the beginning of the end of Zardari ... It is also significant that Zardari did not make the [reinstatement] announcement," she said.
In recent days, US officials, including Hillary Clinton, the secretary of state, had spoken to the country's leaders, urging them to reach a deal.
Washington and other Western nations have been concerned that the crisis would weaken the country's battle against Taliban and al-Qaeda fighters operating along its border with Afghanistan.
"This is a statesmanlike decision taken to defuse a serious confrontation, and the apparent removal of this long-standing national issue is a substantial step towards national reconciliation," the US embassy said after Gilani's announcement.
Al Jazeera's Imran Khan, reporting from Lahore, said that Monday's announcement could be seen as an embarrassing climb-down by the government or a move towards national political unity.
March called off
Farahnaz Ispahani, an aide to President Zardari, insisted that the decision had not weakened the government, the president or the prime minister.
|Anti-government protesters fought running battles with police in Lahore on Sunday [AFP]
"Instead of weakening the government or the president or prime minister it has actually strengthened the government," Ispahani said.
"We have taken the issue away from those who wanted to use mob violence and intimidation. We have taken the country out of the political crisis in an extremely mature and political way."
The government concession came as thousands of protesters led by Nawaz Sharif, the main opposition leader, held a day of protest in Lahore on Sunday, and set off for Islamabad for the climax of a series of protests they had dubbed "the long march".
To stop them from driving into the capital, the authorities had beefed up security, put the army on alert and positioned containers and trucks across roads outside the city, with violent confrontation appearing inevitable.
Following Gilani's announcement, Sharif said he was calling off his protest march.
"Today the nation has received very happy news. We have said that we will restore the judges and the independent judiciary and by the grace of Allah we have achieved it," Sharif said, adding that "very soon we will play our role in implementing real democracy in this country".
Sharif, leader of the Pakistan Muslim League-Nawaz (PML-N) party, had thrown his support behind the protest campaign by lawyers and judges, and senior members of his party were quick to claim an emphatic win for the government's climb-down.
He latched on to Chaudhry's cause two years ago but the current crisis began when Zardari ejected the PML-N from power in Punjab last month, after the supreme court barred Sharif and his younger brother Shahbaz from holding elected office.
Gilani's early-morning announcement on Monday on Chaudhry's reinstatement concluded a day of dramatic developments.
Before dawn on Sunday, hundreds of police surrounded Sharif's residence in Lahore, carrying an order for his house arrest.
Sharif rejected the order as illegal and later left the house in a convoy of vehicles as police stood by.
Some of the protesters defied police barricades to gather near the city's main courts complex and pelted riot police with rocks.