First Minister Nicola Sturgeon said scientific advisors had backed the move as part of a phased lifting of restrictions.
Pupils will still need to wear masks in communal areas and when moving around inside school buildings.
Ms Sturgeon said it would return pupils to "a more normal experience after many months of sacrifice".
The remaining restrictions on school assemblies and visits are also to be lifted, with other curbs to be kept "under regular review".
The Scottish Conservatives said the changes had taken "far longer than was necessary", with young people's education "unnecessarily disrupted for far too long".
However the EIS teaching union said it would have rather seen masks kept in place until the end of March.
The first minister insisted the change was being made "at the right time and in line with expert advice".
Several meetings with scientific and education advisors have been held this week, with Ms Sturgeon saying she wanted to announce a decision before schools head off for the February break.
She said the changes - which will apply to pupils and staff - would "help reduce barriers to communication in the classroom and reduce any wellbeing impacts which arise from the use of face coverings".
And she said anyone who still wanted to wear a mask in the classroom should be supported in doing so.
Primary school children have never had to wear masks in the classroom.
Pupils in some areas of Scotland have been wearing masks in classrooms since October 2020.
It's a measure which at times put teenagers in school under stricter Covid rules than the rest of society.
Whenever I speak to young people about this, most say they don't mind wearing them - but they would rather they were not around.
They say it makes it harder to understand their teacher, and this can particularly be a barrier for those studying for exams.
Teaching unions, although softening to the idea, would still have preferred masks to stay in classrooms a little longer, until we were completely clear of the winter months.
Announcing the move, the government highlighted falling Covid case rates for secondary-age children, alongside falling hospital numbers and an increase in vaccination rates.
Scottish Tory leader Douglas Ross said the government had done a U-turn after "weeks of refusing to budge".
But Ms Sturgeon insisted the change was being made at the appropriate moment, and accused Mr Ross of "deep irresponsibility".
She said: "Had we made this change weeks ago we would have done so at a time of soaring infection rates among school age children and put them and indeed those who work with them in schools at greater risk.
"Had we done it before today it would have been acting against expert and scientific advice. It would have been the wrong thing to do - we are doing it now at the right time and in line with scientific advice."
EIS general secretary Larry Flanagan said he would have kept masks in place for an extra month, noting that many staff and pupils are still absent due to Covid.
He said: "There has been a slight drop in infection levels within schools but they remain high - over 4,000 staff are off school for Covid related reasons and more than 20,000 pupils.
"Therefore enforcing the remaining mitigations around ventilation and face coverings in communal areas remains critical to school safety."
Mr Flanagan also said pupils and staff with "heightened vulnerability" should still be allowed to wear masks - something which was echoed at Holyrood by Green MSP Ross Greer.
Ms Sturgeon stressed that any pupil or member of staff who would "feel safer" wearing a mask should continue to do so.
She said: "In all of the decisions we are taking its important that we balance the understandable desire to get back to to normal with understanding that those who are more clinically vulnerable have a real sense of anxiety, and we need to consider their needs and concerns as well."
Face mask rules were eased in England's schools in January, and Prime Minister Boris Johnson has said all legal restrictions - including the need to self-isolate - could be dropped later in February if Covid data continues to stabilise.
The Scottish government is to set out its "strategic framework" for dealing with the virus in future on 22 February.
Ms Sturgeon has said ministers will "think quite fundamentally" about their approach, in a bid to manage the pandemic without strict curbs.
However she has also been critical of Mr Johnson's approach, with the Scottish government moving to extend the powers which underpin face covering and vaccine passport rules for another six months.
A spokesman said that isolation and mask wearing had been "among the most effective non-pharmaceutical interventions in suppressing Covid spread".