Wales will go into a “short, sharp” national lockdown from Friday until Monday, 9 November.
People will be told to stay at home, while pubs, restaurants and non-essential shops will shut.
Primary schools will reopen after the half-term break, but only Years 7 and 8 in secondary schools will return at that time under new “firebreak” rules.
Gatherings indoors and outdoors with people not in your household will also be banned.
First Minister Mark Drakeford said the “time-limited ‘firebreak'” will be “a short, sharp, shock to turn back the clock, slow down the virus and buy us more time”.
Without action the NHS will not be able to look after those falling sick, he told a press conference.
Leisure businesses, community centres, libraries and recycling centres will shut. Places of worship will be closed for normal services, except for funerals and weddings.
The announcement follows rising case numbers in Wales and increasing hospital admissions, and replaces the 17 local lockdowns that had been in place.
Figures now stand at 130 coronavirus cases per 100,000 over seven days – there were 4,127 cases recorded between 9 and 15 October.
Halloween and Bonfire Night gatherings will not be allowed under the restrictions, which begin at 18:00 BST on Friday.
But there will be an exception for small Remembrance Sunday commemoration services on 8 November.
Non-essential cross border travel in and out of Wales “will have to end” during the firebreak period, Mr Drakeford said.
Universities in Wales will continue to provide “a blend of in-person and online learning”.
If students have reading weeks or half-term they will also need to stay at home in their university accommodation, the first minister said.
The Welsh Government has provided a package of almost £300m to support businesses.