In 1601, Philip III, on the advice of his minister, the Duke of Lerma, ordered the relocation of the court to Valladolid, where he stayed five years, bringing back to Madrid in 1606. After this return, Felipe III makes some decisions that would be significant in the future shape of the city in 1616 ordered the construction of the Plaza Mayor and in 1618 acquired and extensive gardens and fountains land currently comprising the Retiro.
His son and successor, Philip IV, he created in 1625, the fourth wall of Madrid, which will continue until mid-nineteenth century. During his reign, the town was an exceptional period of cultural splendor, with the presence of genius of the stature of Cervantes, Quevedo, Góngora, Velázquez, Lope de Vega and Calderón de la Barca.
During the Habsburg dynasty the town undergoes a fundamental transformation. The core, medieval, about the present street of Segovia, was transferred to the vicinity of the renovated Palace and are built all the buildings necessary for the administration of the Spanish monarchy: the Mint (the present Plaza de Oriente), the Palace Councils (now Captain General), the Court Prison (now headquarters of the Ministry of Foreign Affairs, etc.). Also multiply the number of parish churches and chapels, of which important examples have survived as the church of San Cayetano, San Isidro Chapel or the church of San Ginés.
Among the convents, in addition to the Incarnation and the Royal Barefoot, extending the Jeronimos Monastery and the city-based fixed most of the most established religious orders like the Dominicans (Basilica de Nuestra Senora de Atocha), the Franciscans (now the Hospital Chapel of the Third Order of San Francisco), the Jesuits (Basilica of San Isidro, Imperial College), Convent of the Trinity-current seat of the Archbishop General Military-). It also sets the military orders (Monastery of the Commanders of Santiago, Calatravas Monastery, etc.). Finally, it gives the municipality a new headquarters, with the construction of the Casa de la Villa (former headquarters of the council) in the current Plaza de la Villa, and various agencies for unions in what would become the Plaza Mayor.