Map from Google - Madrid

Madrid, capital of Spain, has a slightly continental climate, with moderately cold winters, and hot and sunny summers. The city is in fact at the centre of the Meseta, the Iberian plateau, at about 650 metres (2,100 ft) above sea level.
Here are the average temperatures.
Average temperatures - Madrid
Min (°C)13461014181714953
Max (°C)101216182228323227201411
Min (°F)343739435057646357484137
Max (°F)505461647282909081685752

Winter, from December to February, is relatively mild: the average January temperature is 5.5 °C (42 °F). The rains, brought by Atlantic depressions, are quite frequent, but generally not abundant. Days can be mild, especially when the Azores anticyclone settles on the Iberian Peninsula, bringing periods of good weather also in winter, with highs around 13/15 °C (55/59 °F), but typically the nights remain cold, with lows near freezing (0 °C or 32 °F). Sometimes, at night and in the early morning, especially in December and January, fog can form.
Every now and then, cold waves may occur, with snowfalls and frosts. Here are the lowest temperatures reached in recent decades at the airport of Cuatro Vientos: January 1985: -8 °C (18 °F); February 1986: -8 °C (18 °F); February 2012: -7 °C (19 °F).

Summer, from June to August, is hot and sunny; the mean temperature in July is 25 °C (77 °F). The temperature is often torrid during the day, given that highs can easily reach 35/36 °C (95/97 °F), with peaks of 40 °C (104 °F), however the air is dry, so the heat is more bearable. In addition, at night the temperatures remain fairly cool, swinging typically from 15 °C to 20 °C (59 to 68 °F).

Spring and autumn are mild and characterized by a variable weather, with periods of good weather, alternating with the passage of Atlantic disturbances, which bring clouds and rain.

The amount of sunshine in Madrid is great in summer, when clear skies prevail: in July there are on average 12 hours of sunlight. Sunny days are possible throughout the year: after all even from November to January there are no less than 4/5 hours of sunshine per day.

The rains are not abundant: the total annual rainfall is 455 millimetres (18 inches), and in fact the landscape of the plateau is semi-arid, especially during the summer months. The rains, however, are quite frequent from October to April. In May and more rarely in summer, a few afternoon thunderstorms may break out, but generally from June to August it almost never rains.
Here is the average precipitation.
Average precipitation - Madrid
Prec. (mm)403525505530151525505560455
Prec. (in)1.61.4122.


When to go

The best periods to visit Madrid are spring and autumn, especially in May, June and September. In June, however, it can already be hot. In April, it can be a bit cold, especially in the first half of the month, and still at night in the second half of the month, when the days are generally pleasant.
September, too, is a good month, but at the beginning it can still be hot, while during the month the first rains can occur. In October, the air is often mild, but the days are getting shorter, the rains are more frequent and it can be a bit cold at night.
Those who can stand the heat can choose July and August, but must be prepared to stroll around the city in hot weather.
The temperature range between day and night is often high, so it is useful to dress in layers and to bring something warm for the evening: you may want a sweatshirt for the coolest hours also in summer.