Málaga, where it's located

In Málaga, a city located on the coast of Andalusia, in southern Spain, the climate is Mediterranean, with mild and relatively rainy winters, and hot and sunny summers. The average temperature in January is 12 °C (53.5 °F), that of August is 25.5 °C (78 °F).
Here are the average temperatures.
Málaga - Average temperatures
Min (°C)78910131720211814118
Max (°C)171819212427303028242017
Min (°F)454648505563687064575246
Max (°F)636466707581868682756863

Precipitation is not abundant, since it amounts to 525 millimetres (20.5 inches) per year, and follows the Mediterranean pattern, in fact it mostly occurs from October to March, while in summer it almost never rains. The rainiest month is November. Here is the average precipitation.
Málaga - Average precipitation

The wind blows frequently: in the cold half of the year it comes along with Atlantic depressions, while in summer it blows in the form of afternoon breeze.

Winter, from December to February, is mild, and is characterized by sunny periods, alternating with periods of bad weather, with wind and rain. Very cold days are rare: only on colder nights the temperature can drop to the freezing point, but even in these cases, during the day usually the temperature rises above 10 °C (50 °F). In practice, it never snows nor freezes. In January 1985, very cold in much of Europe, the night temperature dropped only once below freezing, to -3 °C (27 °F).

Spring, from March to May, is mild and sunny, with rainy days still possible, but not so frequent. In May, and sometimes in April, the first hot days occur, with highs around 30 °C (86 °F).

Summer, from June to mid-September, is hot and sunny. Typically the temperatures hovers about 27/28 °C (81/82 °F) in June and September, and 30 °C (86 °F) in July and August, the air is humid, but sea breezes blow, in short, the typical Mediterranean summer. However, when the wind blows from the interior of Andalusia, the heat can be torrid, and the temperature can reach 35/37 °C (95/99 °F), and sometimes even 40 °C (104 °F); fortunately in this cases the wind is lively and the air becomes drier: it is advisable to drink often, to avoid dehydration.

Autumn, from mid-September to November, is initially warm, and then becomes gradually milder, while periods of bad weather become gradually more frequent. In October, there are many warm and sunny days as well, especially in the first half. By November, we are in the middle of autumn, with a mild climate, though often cloudy and rainy. Sometimes the rains can be concentrated in a short time and can be heavy.

Malaga, view

The amount of sunshine in Málaga is very good in summer, when clear skies prevail, it is good in spring, when cloudy periods are sometimes possible, while it is decent in autumn and winter, when in addition to sunny periods, cloudy and rainy days occur with some frequency.
Málaga - Sunshine

For swimming, the Alboran Sea is never very warm, given the infiltration of water from the Atlantic Ocean: it's still very cool in June, when the temperature is about 20 °C (68 °F), then it reaches 22 °C (72 °F) in July and September, and 23 °C (73 °F) in August, when it becomes overall acceptable for swimming.
Here are the average sea temperatures.
Málaga - Sea temperature
Temp (°C)161515161720222322201816
Temp (°F)615959616368727372686461

When to go

The best time to visit Málaga, for walks and hikes, is spring, in April and May; you can also choose the beginning of autumn, from mid-September to mid-October, although sometimes there can be quite intense rains.
For swimming and sun bathing, in Malaga and the Costa del Sol, 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 first part of June.