Teaching unions have pressed for distancing in secondary schools as pupils were told they will have to wear face masks from next week.
Union leaders insisted that physical distancing in high schools remained the most effective way of preventing transmission of Covid-19.
The Scottish Government has issued “obligatory guidance” to schools stating that masks should be worn from Monday in areas where distancing is difficult, such as corridors and communal areas.
They are also to be worn on school buses by children aged five and over, in line with rules for public transport.
Deputy First Minister John Swinney said: “There is increasing evidence that face coverings can provide some protection for the wearer as well as those around them.
“We also know that some pupils have found it very difficult to physically distance when moving around school, which could increase the risk of transmission of the virus.
“And on school transport, as on public transport, there can be mixing between different age groups.”
He said the government had worked with partners in the education recovery group to update the guidance, and schools would be asked to ensure pupils have clear instructions on how to wear and store face coverings.
He said: “We want to continue to protect what we have achieved in suppressing the virus and re-opening schools, and to do the best for children in schools.
“Alongside this change to the wearing of face coverings, we need to reinforce the importance of maintaining high standards of cleaning, personal hand and respiratory hygiene and physical distancing, where possible.
“In situations where there is a local cluster, use of face coverings throughout the day may be required.”
In a survey of parents by The Courier opinion was divided on whether face masks in school should be voluntary.
Currently guidance states distancing is not required in secondary schools but should be encouraged where possible, particularly among senior pupils.
But the Scottish Secondary Teachers Association said more than face coverings were needed to make schools safe and distancing measures must be introduced.
Responding to news on face coverings on Twitter, general secretary Seamus Searson said: “Now for physical distancing in schools.”
The Educational Institute of Scotland welcomed the introduction of masks but also said distancing was also needed.
Larry Flanagan, general secretary of EIS.General secretary Larry Flanagan said: “The EIS believes that effective physical distancing between pupils is the best means of reducing the risk of Covid-19 spread in schools.
“This is an area where the guidance from the Scottish Government currently lacks specificity; there needs to be a much sharper focus on ensuring social distancing in schools to protect pupils, staff and the wider community.
“Smaller class sizes to ensure appropriate physical distancing of pupils are essential.”
The GMB has also demanded a testing regime in every school, after a survey of members found two-thirds of support staff in schools and nurseries did not feel safe at work.
Representing staff including cleaners, janitors, caterers and pupil support assistants, the union wants workers to be able to access Covid testing in the workplace like those in the social care sector.
GMB Scotland organiser Helen Meldrum said: “If support staff need to book a test they must absorb the financial costs and time implications to do so, and for a chronically low-paid workforce with many employed on multiple contracts across multiple workplaces, that’s just not credible.”
She said the political focus had been teachers and pupils while support staff have been forgotten.