Scottish secondary school pupils will have to wear face coverings in corridors, communal areas and school buses from next Monday.
Education Secretary John Swinney said the new guidance would apply to all pupils aged over 12.
He said the guidance would be updated based on new advice from the World Health Organization (WHO).
There will no requirement to wear face coverings in classrooms where social distancing measures are in place.
Mr Swinney said individual exemptions could be granted for health reasons, but the guidance would be “obligatory” for all secondary, special and grant-aided schools.
He told the BBC’s Good Morning Scotland programme: “From August 31st young people over the age of 12 in secondary schools should habitually be wearing face coverings when they are moving around schools and corridors and in communal areas where it is difficult to deliver the physical distancing, which is an inherent part of the guidance the education recovery group has put in place.”
He said the Scottish government had acted in the light of the new WHO advice based on evidence that teenagers can infect others in the same way as adults, but had decided to go further by extending it to school transport.
“It’s part of the general measures we are taking to ensure we keep pace with the emerging advice about how to keep our schools open and to keep our schools safe.”
Young people returned to Scotland’s schools earlier in August with no requirements for physical distancing between younger pupils, and no rules around face coverings.
But First Minister Nicola Sturgeon signalled on Monday that a change in the guidance was imminent, saying the government was in the “final stages” of consulting with councils and teachers.
Eileen Prior, chief executive of the parents’ organisation Connect, formerly known as the Scottish Parent Teacher Council, earlier said she hoped schools would be offered some flexibility over how the new guidance was implemented.
She said: “In some schools it won’t be necessary – it depends very much on the environment within a school.
“Some schools are incredibly crowded but some simply aren’t and some are well below capacity, perhaps with wide corridors and they don’t have the issue that we have in many high schools of young people just crowding because they just can’t not crowd.”
Mr Swinney said while the new rules were not mandatory, they had the same status as other guidance on reopening of schools such as physical distancing and hand hygiene measures.
“There will be exemptions from this because the wearing of face coverings is not suitable for all individuals and that has to be respected,” he said.
While the guidance should be considered obligatory across the secondary sector, he said an individual pupil should not be excluded because they were not wearing a face covering.