Secondary pupils will have to wear face coverings in school corridors in local lockdown areas of England, after the government reversed its guidance.
Head teachers in any secondary school will also have the “flexibility” to introduce masks in their schools.
Education Secretary Gavin Williamson said it followed updated advice from the World Health Organization.
But Labour accused the government of “passing the buck” on decisions back to schools.
Prime Minister Boris Johnson said the new guidance meant that in coronavirus “hot spot” areas that “it probably does make sense in confined areas outside the classroom to use a face covering in the corridor and elsewhere”.
The change in rules, announced on Tuesday night, will not mean face coverings in the classroom – which Mr Johnson said would have been “nonsensical” as “you can’t teach with face coverings and you can’t expect people to learn with face coverings.”
Mr Johnson, at a school in Leicestershire, told pupils their exam grades were “almost derailed by a mutant algorithm” and the biggest risk to them was not Covid-19, but “continuing to be out of school”.
His comments came just before the government announced a change in the leadership at the top of the Department for Education.
The most senior civil servant in the department, permanent secretary Jonathan Slater, has been asked to stand down.
A statement said the prime minister had concluded there was “a need for fresh official leadership at the Department for Education”.
It added: “Jonathan Slater has therefore agreed that he will stand down on 1 September in advance of the end of his tenure in Spring 2021.”
The policy switch on face coverings, so near to the return to school, had drawn criticism from some Conservative MPs.
Huw Merriman said the use of face coverings sent “the wrong message” which suggested “schools are not a safe setting”.
Mr Williamson insisted the government was listening “to the latest medical and scientific advice” and taking “the most precautionary approach”.
The Department for Education says it is still keeping its recommendation against using face coverings – but that secondary schools will now be able to make their own decisions whether to ask pupils and staff to wear them.
This will be in “communal areas” of schools such as corridors, where it is difficult to maintain social distancing, and when schools “believe that is right in their particular circumstances”.
But in parts of the country with high levels of coronavirus transmission, such as those with local lockdown measures, face coverings will be compulsory in such communal areas for adults and pupils.
The new guidelines, which apply from 1 September, also warn that “stricter guidance” on face coverings could apply to all schools “if the rate of transmission increases across the whole country”.
On Wednesday the Department for Education said all schools would be supplied with 10 coronavirus testing kits, to be used in “exceptional circumstances” when no other way of testing is available.
They would also be given a “small amount” of personal protective equipment (PPE), such as aprons, gloves, visors and clinical face masks.
The change on face coverings follows the WHO updating its advice last week, which now recommends that children aged over 12 should wear masks under the same conditions as adults.
The government had been under pressure over face coverings in England’s schools – with secondary schools in Scotland to use them in corridors and communal areas from next week.
The ASCL head teachers’ union had warned of confusion about the rules over face coverings – and said there was a lack of clarity over how schools should respond if teachers or pupils wanted to wear masks.
After the government’s change of policy, the union’s leader, Geoff Barton, said school leaders would “welcome the flexibility” of being able to “decide what best suits their circumstances”.
But Paul Whiteman, leader of the National Association of Head Teachers, said: “It is neither helpful or fair to ask school leaders to make individual decisions about face coverings in their school. Such decisions should rest with public health officials.”
Kevin Courtney, of the National Education Union, welcomed “the steps now being taken” but criticised the “slow, incoherent” way the decision had been reached – and said it would not inspire confidence with parents or teachers.
Conservative MP Huw Merriman said the change in guidance was “causing uncertainty”.
“My concern is that we just keep making this up as we go along,” the Tory MP told BBC Radio 4’s Today programme, adding that the government “needs to get a grip”.
Asked whether he took responsibility for the decisions made on face coverings and exam grades, Mr Williamson admitted it had been “incredibly difficult and incredibly tough”.
“At every stage, everyone takes responsibility for what they do and how they approach things and what we’re focused on is making sure we deliver the best for children right across the country,” he told BBC Breakfast.
Some parents said they wanted to see face coverings mandatory in communal areas of all secondary schools.
Pamela Allen, from Canterbury, said her son’s secondary school had told her it would be following government guidance and would not require face coverings to be worn.
“I think [the government] should be leading the charge against the virus as opposed to reacting to it if there is a local lockdown,” she told the BBC.
“It would make us feel confident that we are sending our children to as safe a place as we can.”
She added she would be sending her son to school with a face covering to wear between lessons.
Despite the official guidance against face coverings, some schools had already been preparing to use them.
The Oasis academy trust, with more than 50 schools in England, is to provide visors for its teachers – and secondary pupils were going to have to wear masks in corridors.
Steve Chalke, chief executive of the trust, said there was a responsibility to make schools “as safe as we possibly can” – and that meant using masks and visors.
He said that masks might increase the confidence of parents “nervous” about sending their children back to school.
Labour’s Shadow Education Secretary Kate Green said face coverings should be compulsory in communal areas of schools.
“Instead of this half baked U-turn, the government should have given clear guidance and a plan to deliver it,” she said.