Spain is following Italy's path in implementing a similar lockdown after both European countries failed to contain the virus in regional hotspots.
"From now we enter into a new phase," Spanish Prime Minister Pedro Sánchez told the nation in a nationally televised address after his Cabinet met for over seven hours.
"We won't hesitate in doing what we must to beat the virus. We are putting health first."
Shortly after he spoke, the government revealed that the virus had reached Sánchez's own home, saying his wife, Begoña Gómez, had tested positive for the COVID-19 virus. The government said both Gómez and the prime minister are in good health.
Two ministers of Sánchez's Cabinet, the minister of equality and the minister of regional affairs, had already tested positive earlier this week. The other members of the government passed a screening.
Following his address, people broke into a long round of applause from balconies in Madrid and Barcelona, with some firing off fireworks, in response to a call on social media for a show of support for the country's doctors and nurses. Others joined in, relieved that the government was taking more action.
Sánchez added that all police forces, including those run by local authorities, will be put under the orders of the Interior Minister and that the armed forces are on stand-by.
"At any moment, when it is necessary, we can count on the deployment of the armed forces. The army is ready," Sánchez said.
According to the government decree, people will only be allowed to leave their homes to buy food and medicine, commute to work, go to medical centers and banks, or take trips related to the care for the elderly, the young, and dependents. Those limitations are effective immediately.
Spain is also closing all restaurants, bars, hotels, schools and universities nationwide, and other non-essential retail outlets, a move some of its hardest-hit communities have already carried out.
The state of emergency also gives the government the power to take control of private hospitals to reinforce its large public health service that is being pushed to the brink in the capital and other areas. The strain on Madrid's medical system had led local authorities to devise a plan to convert hotels into temporary wards to care for less serious patients and clear space in the overburdened critical care areas.
Health authorities said Saturday that coronavirus infections have reached 5,753 people, half of them in Madrid, since the first case was detected in Spain in late January. That represents a national increase of over 1,500 in 24 hours.
Sánchez acknowledged on Friday that the number of infections could reach 10,000 in the coming days.
"We are going to win this battle," Sánchez said. "The important thing is that price we have to pay be as low as possible, the lives we can save, the infections we can prevent, and sick days we can avoid."
Italy extended the strict restriction on movements from the north to the entire country on March 9 when it registered over 9,000 infections. It then went further on March 11 and closed all retail outlets except some supermarkets and pharmacies.
Spain's central government had been criticized by some regional authorities, who run the nation's decentralized public health system, for taking too long to shut down the entire country.
The decision by Sánchez comes after some regions of Spain with viral clusters had taken steps to close restaurants and other non-essential establishments. The regional leaders of Madrid and northeast Catalonia had criticized Sánchez for taking too long to tighten the screws on transport and restrict the circulation of people.
Residents in Madrid and Barcelona awoke Saturday to shuttered bars and restaurants and other non-essential commercial outlets as ordered by regional authorities the day before.
The normally bustling streets of Spain's two biggest cities were noticeably quieter as the message sinks in that social distancing is the only way to stop the global pandemic after its eruption in China.
Spooked shoppers packed some supermarkets early in the morning despite calls for calm from authorities and supermarket owners.
Business owners fear that the closures will be crippling, especially in Spain's huge tourism industry, but they are resigned to comply. Even though the airports remained open, some flights bound for Spain turned around as word spread of the lockdown.
"We had to close and remain shut for 15 days," restaurant owner Rachel Paparardo said in Barcelona, Catalonia's largest city. "But this is nothing, it is just so more people don't get infected and we can recover from this."
In the capital, however, the town hall was forced to close parks after many people continued their Saturday morning jogs and other outdoor pastimes, with municipal police resorting to airborne drones with speakers to urge people to go home.
"I live in the city center and I like to see it empty," said Madrid resident Carmen Melon. "I like to see that I think people are being responsible and the people who have to stay at home are doing it. Today I have to work, just one hour, but later I will stay home too."
Sports and television personalities have joined authorities and public health care workers in their pleas for people to remain indoors in order to reduce the spiking contagion curve.
"It is the moment to act responsibility and to stay home," Barcelona star Lionel Messi wrote on Instagram Saturday.
It's only the second time that the government has evoked it since the return of democracy in the late 1970s. The other was declared during a 2010 air traffic controllers' strike.