The National Assembly approved the controversial Protection of State Information Bill on Tuesday despite widespread opposition and question marks around its constitutionality.
The bill was adopted by majority vote after a division was called by the opposition Democratic Alliance, and passionate objections were raised by opposition parties.
The IFP warned that the legislation would lead the ANC to lose its legitimacy for opposing the popular will.
Congress of the People leader and former ANC minister Mosiuoa Lekota said the African National Congress would, like the apartheid state, suffer the shame of jailing journalists and whistleblowers who alerted the public to wrongdoing.
"I shudder to think that the men and women who say that money is being stolen will be locked up in the name of the African National Congress," he shouted to loud applause from the opposition benches and a packed public gallery.
Most opposition parties present in the House proceeded to vote against the legislation, while hundreds of black-clad activists protested against it outside the gates of Parliament and elsewhere in the country.
The outcome of the vote was 229 in favour and 107 against in the 400-member House. There were two abstentions.
The bill still has to be approved by the National Council of Provinces next year.
Democratic Alliance parliamentary leader Lindiwe Mazibuko said her party would continue the fight for incisive amendments in the second house.
If that process failed to produce a new version, she would petitihon President Jacob Zuma not to sign the bill, but to send it back to Parliament.
"But if this bill is signed into law, I will lead an application to the Constitutional Court to have the act declared unconstitutional," Mazibuko vowed.
Like the opposition, media organisations, activists and ANC ally the Congress of SA Trade Unions have demanded that the bill be redrafted, and have vowed to challenge it in the Constitutional Court if it is signed into law in its current form.
All insist that the bill should include a public interest defence, as enshrined in state secrecy legislation in Canada.
Such a defence would enable journalists and others who published classified information under pain of prison to argue in mitigation that they had done so in the public interest.
State Security Minister Siyabonga Cwele reiterated last week that the ANC would not countenance such "reckless practice".
The bill criminalises possession and publication of classified information and punishes the latter with up to 25 years in prison, if espionage is involved.
It was drafted to replace apartheid-era legislation dating from 1982, but critics say it marks a shameful return to excessive state secrecy less than two decades into democratic rule.
The editors of 18 daily news publications said in a joint editorial on Tuesday that it was "the first piece of legislation since the end of apartheid that dismantles an aspect of our democracy".