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.
- Lifting lockdown: What you can and can't do during Spain's Phase 1
- Q&A What are the rules for meeting friends during Spain’s Phase 1?
- Museums, hotels and bars to reopen in Madrid, Barcelona
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.
Bars prepare to open their terraces in Madrid's Plaza Mayor. Photo: AFP
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 new arrivals to Spain must quarantine for 14 days.
- Lifting lockdown: What changes in Spain when your province advances to Phase 2
- What you need to know about Spain’s new quarantine rules for travellers
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.