Four centuries later, on a warm spring day, it seems an entirely happy choice, but at the time it hardly made sense at all. Geographically Madrid is right in the middle of the Iberian peninsula, which might have seemed convenient, but it doesn't have a navigable river, which was a serious disadvantage in those days.
And there wasn't even a cathedral. But Philip wanted it anyway, perhaps just to show that the king could do just as he liked. In some respects, it was the Milton Keynes of its time, but built to demonstrate the power of the Hapsburgs rather than the supremacy of town planners.
When I lived in Madrid as a child it certainly seemed a huge city, with grand palaces and statues and parks, and fountains instead of roundabouts in which heroic figures were pulled by galloping horses through jets of water, and everything lit up at night. Returning recently as an adult I was relieved to discover that it looked as magnificent to my grown-up eyes. Neptune still raises his trident in a mist of spray in the middle of Plaza Canovas de Castillo, not far from the Prado museum; the Spaniards have not lost their talent for floodlighting; and I was nearly run over a hundred times as I stopped half-way across streets to admire another sweep of avenue or calculated vista.
These grand streets and buildings made the perfect backdrop for a procession of Habsburg rulers, and the people of Madrid squeezed themselves into the remaining spaces as best they could. Behind the main thoroughfares is a tangle of narrow streets, lined with four- or five-storey houses and small shops. Wandering through, you stumble into tiny squares almost taken up by a cafe terrace, and it's hard - and possibly pointless - to resist the temptation to stop at each one for a taste of something. I often remember places by what I ate or drank there. In the case of Madrid that meant the hideously sweet things I liked as a child; I was especially fond of a make of bread and cakes called, rather unfortunately, Bimbo.
Strolling from cafe to bar to park and so on is a Madrid speciality, so it was strange that at six o'clock on a Saturday afternoon the streets were almost deserted. Ten hours later you could hardly move for people, and the traffic was at a standstill. The Protestant ideal of early bedtimes never reached this far south, and many bars stay open until two or three, especially at the weekend. Madrid is a wonderful place to be at night; you meander down narrow roads busy with groups of strolling Madrilenos of all ages, searching for the bar with the best wine or the most famous tapas, perhaps after a trip to the cinema (late screenings start around 1am).
It's a wonderful place to be in the daytime as well. Despite the grandness of much of the architecture, the central area is quite compact, so it's perfectly feasible to walk nearly everywhere, especially as so many hotels are close to the "museum area" round the Prado. The Prado itself is one of Madrid's main attractions, not surprisingly, but it's impossible to take in everything on one visit; luckily the rooms are arranged by artist, so you can see just the El Grecos and the Goyas, for instance. The same is true of the nearby Reina Sofia museum, a former hospital and now a showcase for modern art including Picasso's Guernica. From the glass-sided lifts added to the front of the building, there's a good view of one of Madrid's more unusual attractions, Atocha station, a late 19th-century iron and glass affair now restored to include an indoor tropical garden and several cafes (naturally). It's like a massive greenhouse, yet it's still a working station with a modern extension from where the trains actually run. It's hard to think of a place I'd rather arrive.
From Atocha it's not far to the Retiro, a huge landscaped park with lakes, pavilions and a miniature Crystal Palace (currently being restored). During the week it is not busy, but on Sunday it feels as if the whole population of the city has converged for a walk. Along the path by the boating lake there are puppet shows, clowns and stilt-walkers, and hawkers selling anything from Indian cotton skirts to batteries; by the fountains at either end of the path people set up and play music.
During the week the Retiro is much less crowded, but if you absolutely have to have peace on a Sunday the best place is the Botanical Garden, next to the Prado, created in the 18th century. Strolling round its formal beds, you feel that the city is miles away. It's especially enjoyable in spring as a cure for the "winter will never end" thoughts that afflict northern Europeans; here, winter already has ended.
On the way back from the Retiro to my hotel, I bumped into a friend of a friend who was going to the Plaza Major, one of Madrid's best-known squares, so I went with her. We sat outside one of the many cafes, chatting, drinking and basking in the sun, watching the people ambling past and admiring the architecture. Which is what life in Madrid is all about. Perhaps Milton Keynes will be this civilised in around 400 years' time.