Residents in the two cities can now meet in groups of up to 10 people in their homes or on the terraces of bars and restaurants.
The gates of the capital’s parks will also be reopened, and major museums will be able to receive a limited number of visitors.
The Madrid and Barcelona regions, the most populated in the country, and a large part of Castile-Leon in the northwest are moving into the first phase of Spain’s four-phase deconfinement programme, following what has been one of the strictest lockdowns in the world.
These regions have been on a slower deconfinement track as they bore the brunt of the pandemic in Spain, which has killed more than 28,700 people to date, one of the world’s highest tolls.
Everyone must continue to wear a mask, which is already compulsory in buildings and on public streets when it is not possible to keep a distance of two metres (six feet).
The rest of the country meanwhile — 22 million out of Spain’s 47 million inhabitants — is moving on to the second phase, which is expected to last until the end of June.
Restaurants may then reopen to a limited number of customers, and outings for walks or sports will no longer be limited to certain hours of the day.
As the summer heat arrives, beaches on the Atlantic Ocean coast and in much of Andalusia, as well as on the Balearic and Canary Islands, are open for swimming, subject to safety measures.
The health ministry recommends limiting the number of visitors to the beaches, creating boundaries and spacing umbrellas four metres apart.
Only locals will benefit for the time being. Travel between regions is still forbidden and foreigners arriving in Spain must quarantine for 14 days.
But the government plans to reopen the borders to foreign tourists in July.
The lockdown, in force since mid-March, has been among the most severe in the world.
In the first few weeks, Spaniards could hardly set foot outside and their children were kept indoors.
Many residents have become impatient over the government’s slow and cautious process of lifting the restrictions.
Thousands of people protested on Saturday by car in major Spanish cities at the call of the far-right Vox party.
Drivers honked their horns, waved Spanish flags and banged on pots and pans to denounce the management of the coronavirus crisis by the left-wing government of Pedro Sanchez.