Prime Minister Pedro Sanchez announced the restrictions on movement on Saturday following a huge spike in the number of infections in this nation of some 46 million people.
They are among the measures introduced as part of a 15-day state of emergency officially declared by his government on Saturday.
Spain confirmed more than 1,500 new cases of coronavirus since Friday evening, raising its total to 5,753 cases, the second-highest number in Europe after Italy. The disease has so far claimed 183 lives in Spain.
In response to an appeal made on social media, many residents of the Spanish went to their balconies and windows to applaud and cheer the healthcare workers dealing with the crisis.