Scotland's schools are to formally recognise the issues faced by the LGBTI community as part of the curriculum.
All state schools will be supported to teach LGBTI equality and inclusion across different age groups.
This will include teaching of LGBTI terminology and identities, tackling homophobia and prejudice, and the history of the equalities movement.
Education Secretary John Swinney said this would help promote understanding and inclusion among all students.
The move was welcomed by the Time for Inclusive Education (Tie) campaign group, who called it a "historic moment for our country".
Up until 2000, it was against the law to "intentionally promote homosexuality" in Scotland's schools under the "Section 28" rule.
The Christian Institute, an evangelical group which campaigned against the repeal of Section 28, said "controversial political agendas" should not be embedded in the curriculum.
The government has now accepted all recommendations of an LGBTI inclusive education working group, which was set up with the goal of improving the school experiences of young people.
These included calls for better guidance and training for teachers, school inspections of LGBTI inclusion and the recording of specific incidents of bullying in schools.
Work to implement the changes will begin immediately, with Mr Swinney claiming the move as a world first.
The education secretary said: "Our education system must support everyone to reach their full potential. That is why it is vital the curriculum is as diverse as the young people who learn in our schools.
"The recommendations I have accepted will not only improve the learning experience of our LGBTI young people, they will also support all learners to celebrate their differences, promote understanding and encourage inclusion."
Tie campaign co-founder Jordan Daly said he was "delighted" with the group's "monumental victory".
He said: "The implementation of LGBTI inclusive education across all state schools is a world first, and in a time of global uncertainty, this sends a strong and clear message to LGBTI young people that they are valued here in Scotland.
"Eighteen years from the repeal of Section 28, we can finally put its destructive legacy to bed.
"Education is one of the most vital tools we have to tackle bullying, prejudice and discrimination - and it shapes the fabric of our society. We now look forward to continuing our work with the Scottish Government as we progress towards full implementation."
The Christian Institute's deputy director Simon Calvert said "maths lessons should be about maths, not LGBT politics".
He added: "Many families, religious and otherwise, will be concerned about how far this is going to go.
"There is already a great deal of emphasis on LGBT issues in schools. Perhaps the time and money would be better spent trying to improve education for everyone, instead of promoting LGBT politics."