The law banning councils and schools in England and Wales from intentionally promoting homosexuality, is to be repealed.
Section 28 has been a focal point for equal rights campaigners
The Section 28 repeal clause will come into effect on 18 November, after the Local Government Bill received Royal Assent on Thursday.
The measure has never been used in a prosecution, but has been a focal point for equal rights campaigners since it became law in the late 1980s, under Margaret Thatcher.
The government says the repeal is an important milestone in a series of measures it is taking to tackle discrimination on the grounds of sexual preference.
'Unnecessary and offensive'
Local Government Minister Nick Raynsford said: "For over a decade, Section 28 has cast a cloud of confusion and ambiguity over local authorities' ability to support and provide services to the whole of their community.
"Repeal means that this cloud has lifted."
Mr Raynsford added: "The government is pleased that Parliament has taken advantage of this opportunity to remove this unnecessary and offensive piece of legislation - which has fuelled prejudice and stigmatised homosexuality - from the statute book."
Gay justice group Stonewall chief executive Ben Summerskill called the repeal "a triumph for 21st Century tolerance over 19th Century prejudice".
"Section 28 was a pernicious piece of legislation, deliberately framed to stigmatise a minority group," he said.
"Stonewall has worked long and hard to have this deeply offensive law overturned, and we are delighted that it has finally passed away."
Earlier, Labour attempts to repeal Section 28 had been blocked by the Lords.
But, after the death last year of Tory former Lords Leader and prominent
"family values" campaigner Baroness Young, peers' resistance to repeal
A last-ditch attempt by Tory peers' deputy leader Baroness Blatch to make the repeal of Section 28
dependent on parents being given new rights to vet schools' sex education materials
failed in July, in a free vote, by 180 votes to 130.