Map from Google - Andalusia

In Andalusia, the southernmost region of Spain, there are different types of climate, ranging from the Mediterranean climate of the coast, which becomes particularly arid in the east, to the Mediterranean climate with hot summers in the valley of the Guadalquivir, to the semi-continental climate of low mountains areas, to the alpine climate of the highest mountains.
The region is crossed by two mountain ranges, Sierra Morena to the north and Betic Cordillera (which includes Sierra Nevada) to the south; in the middle we find the Betic Depression, crossed by the river Guadalquivir and characterized by hot summers, where there are cities such as Seville and Córdoba. Some mountain areas are particularly green, and are home to parks, such as Parque Natural de los Alcornocales, and Parque Natural Sierra de Grazalema, both in the south-west, or Parque Natural de las Sierras de Cazorla, in the northeast, or Parque Nacional de Sierra Nevada, located in the south, in the area that is home to the highest peaks of the chain of the same name and throughout continental Spain, starting from Mulhacen, 3,478 metres (11,411 feet) high.
Let's now see the climate of the major cities.
Andalusia, main cities

On the Atlantic coast (called Costa de la Luz), the climate is Mediterranean, with very mild winters, and warm and sunny summers. In Cadiz the average temperature ranges from 12.5 °C (54.5 °F) in January, to 24.5 °C (76 °F) in July and August.
Here are the average temperatures.
Average temperatures - Cadiz
Min (°C)101112131619212220171311
Max (°C)161718192225282826232017
Min (°F)505254556166707268635552
Max (°F)616364667277828279736863

In a typical year, 550 millimetres (21.5 inches) of rain fall, of which more than 80 mm (3.2 in) per month from December to February. In summer, as generally in Mediterranean climates, there is little or no rain.
Here is the average precipitation.
Average precipitation - Cadiz
Prec. (mm)85604050301003205590105547
Prec. (in)

Already in Jerez de la Frontera, about 30 kilometres (18 miles) north-east of Cadiz, the climate becomes slightly colder in winter, especially at night, when occasionally light frosts may occur, while in summer it becomes warmer, especially during the day, when there are several hot days, with highs about 35/36 °C (95/97 °F); the highest records are about 40/42 °C (104/108 °F). Rainfall amounts to about 590 mm (23 in) per year, with a winter maximum and a summer minimum, as usual.
Here are the average temperatures.
Average temperatures - Jerez de la Fr
Jerez de la FrJanFebMarAprMayJunJulAugSepOctNovDec
Min (°C)578912151818171397
Max (°C)161820222529333330252017
Min (°F)414546485459646463554845
Max (°F)616468727784919186776863

Northwest of Jerez de la Frontera lies the Doñana National Park, rich in biodiversity, which near the coast is home to vast sand dunes.
Continuing to the north-east, in Seville, 70 km (45 miles) away from the coast, summer becomes even hotter, so that in July and August highs are normally about 36 °C (97 °F). Rainfall amounts to 560 mm (22 in) per year, still with a Mediterranean pattern.
Here are the average temperatures.
Average temperatures - Seville
Min (°C)56911131720201814107
Max (°C)151720242732363632262016
Min (°F)414348525563686864575045
Max (°F)596368758190979790796861

Continuing to the east, in Córdoba the temperatures are similar to those of Seville, but for the higher distance from the sea, it can sometimes be a little colder in winter, while in summer it can be slightly warmer.

South coast of Spain

The south coast overlooking the Mediterranean Sea can be divided according to the province and of the name that they are given for tourism purposes:
- The most western part, in the province of Cadiz, overlooking the Strait of Gibraltar, though the southernmost, it's also the coolest in the summer, because of the prevalence of the east wind ("levante"). The coolest area corresponds precisely to the southern tip of Spain, at the point that separates the Atlantic Ocean from the Mediterranean Sea (see Tarifa). In this strait you can spot dolphins and whales. A little further to the north-east there's the Bay of Gibraltar: in the western part we find the city of Algeciras, in the eastern La Linea de la Concepcion, and just south Gibraltar, belonging to Great Britain, and having a cool and humid microclimate.
Here are the average temperatures of Algeciras.
Average temperatures - Algeciras
Min (°C)111112131618202120171412
Max (°C)161718192224272826221917
Min (°F)525254556164687068635754
Max (°F)616364667275818279726663

- The central part, called Costa del Sol, corresponds to the coast of the province of Málaga. Here the temperatures are quite similar to that of the Costa de la Luz, Mediterranean-like, with hot summers but not too much, although there can be some very hot days, with highs around 35 °C (95 °F). Here for example, the average temperatures of Málaga.
Average temperatures - Málaga
Min (°C)78910131720211814118
Max (°C)171819212427303028242017
Min (°F)454648505563687064575246
Max (°F)636466707581868682756863

- The eastern part of the coast is divided between the province of Granada, where it's called Costa Tropical (or even Costa de Granada) and the province of Almería, where it's called Costa de Almería. Here the temperatures are similar, while proceeding towards the east the rainfall decreases, and at the same time the temperature of the sea gradually increases (see below).

Precipitation along the Mediterranean coast varies rather significantly, becoming progressively lower towards the east, although the pattern is the same, with a maximum in the cold half of the year, particularly between November and January, and a minimum in summer, when it almost never rains.
Here is the average rainfall in Algeciras.
Average precipitation - Algeciras
Prec. (mm)120105105654010032575150130835
Prec. (in)

The rainfall amount goes from 835 millimetres (33 inches) in Algeciras, where the rains can sometimes be abundant from November to March, to 585 mm (23 in) in Marbella, 525 mm (20.5 in) in Malaga, and 450 mm (17.5 in) in Nerja, while the easternmost part becomes very dry, almost desert: in Almería precipitation amounts to just 200 mm (8 in) per year.
Here is the average precipitation in Almería.
Average precipitation - Almería
Prec. (mm)242516171251114272830200
Prec. (in)0.910.

North of Almería there is a desert, the Tabernas Desert (Desierto de Tabernas), in which several movies were filmed. However, also the southeastern coastal area, from Almería to Cabo de Gata, from San José to Playa de los Muertos, is semi-desert: the cape of Gata is probably the driest place in Europe, receiving 155 mm (6.1 in) of rain per year. Here we find the Cabo de Gata-Nijar Natural Park.

Tabernas Desert

As mentioned, in Andalusia there are several mountain ranges, and cities located at more or less high elevation. The most important, Granada, is situated at 700 metres (2,300 feet) above sea level, and is often cold at night in winter, while in summer, when during the day the heat is often intense, usually nights remain cool.
Jaén, located at an altitude a bit lower, 500 metres (1,600 feet) above sea level, winter is mild enough (despite some cold days), while summer is hot (with several torrid days). Precipitation amounts to 500 mm (20 in) per year, with a maximum in December (80 mm or 3.1 in), and a minimum in July (2 mm or 0.08 in). Here are the average temperatures in Jaén.
Average temperatures - Jaén
Min (°C)5691013182121181496
Max (°C)121418192330343328221613
Min (°F)414348505564707064574843
Max (°F)545764667386939182726155

At higher altitudes, the temperature drops further, but still at about 1,000/1,200 metres (3,300/3,900 feet) the maximum temperatures in summer are about 29/31 °C (84/88 °F).

Marbella, Playa Real

The temperature of the sea along the Atlantic coast (Costa de la Luz) remains cool even in summer, as we can see in the following table.
Sea temperature - Costa de la Luz
Costa de la LuzJanFebMarAprMayJunJulAugSepOctNovDec
Sea (°C)161516161719202121201817
Sea (°F)615961616366687070686463

Even in the Costa del Sol the sea is never very warm, due to the infiltration of the Atlantic waters, however, in summer it becomes slightly warmer than in the Atlantic coast.
Sea temperature - Málaga
Sea (°C)161515161720222322201816
Sea (°F)615959616368727372686461

Continuing to the east, and entering the Mediterranean coast, the sea becomes gradually warmer in summer: in Almería the sea temperature reaches 24 °C (75 °F) in August and 23 °C (73 °F) in September; in the far east, in the part of the coast facing southeast, it becomes even warmer, so much so that in Mojacar it reaches 25 °C (77 °F) in August.
Sea temperature - Mojacar
Sea (°C)151515161820232524211816
Sea (°F)595959616468737775706461

When to go

The best months to visit Andalusia, if the trip includes the plain of the Guadalquivir and cities such as Seville and Córdoba, are April, May and October, to avoid the summer heat, although in these months sometimes it can rain. Those who can stand the heat can choose summer, where in the inland plain there is a scorching heat, but also a more pleasant weather in the high mountain areas. In winter you can find several pleasant days in the plains, sunny and spring-like, although it can get cold at night in the interior, and waves of bad weather cannot be excluded.

For the sun and the sea, the best time is instead the summer, from June to mid-September. It's better to bring a sweatshirt for cool and windy evenings, especially in the Costa de la Luz and in the province of Cadiz, but for safety even in July and August, particularly if you are sensitive to cold.

In winter you can ski in the Sierra Nevada, and maybe take a trip to the sea, where you will usually find a mild weather (though not hot: we are still in the Mediterranean winter), with several sunny days, and possible but not abundant rain.