Map from Google - Peru

In Peru, a country located just south of the Equator, there are three climates zones: a desert coastal strip (la Costa), with a mild climate, cloudy and foggy in winter and pleasantly warm in summer; the Andean zone (la Sierra), more or less cold depending on altitude, and finally the large eastern area covered by the Amazonian forest (la Selva), with a hot and humid climate throughout the year.

Peru, climate of the coast
Along the Peruvian coast, the climate is very peculiar. The temperature varies little over the year, and is almost always spring-like, but it almost never rains and therefore the landscape is desert. The reason why along the coast there is a desert, is found in the Humboldt Current, which flows on the ocean and cools the lowest layers of the atmosphere, thereby inhibiting the formation of vertical air currents, which are necessary for the formation of rainclouds. However, this situation in which cold air clings to the soil or the sea surface, leads to the formation of fog and low clouds, which occur often, especially in the cold season, while above 500 metres the sunshine prevails, as happens in the Andean locations lying above the foggy layer.
The daily average temperature ranges from 18 °C in the coldest month (August), to 24 °C in the warmest month (February) in the north (see El Alto), from 17 °C to 23 °C in the centre (see Lima and Trujillo), and from 15 °C to 22 °C in the south, near the border with Chile (see Ilo).

Fog in Lima

In Lima, the capital, basically it never rains. During winter, from June to September, the sky is almost always cloudy, and there is a mist, the Garúa, which can deposit moisture on the ground; the temperatures are mild, with highs around 18 °C, and lows only a few degrees below, but the lack of sunshine and the high humidity make the residents of the capital feel cold, also because they often live in unheated homes. The temperature inversion favors the accumulation of pollutants, despite the proximity of the sea.
During summer, from December to April the sun often shines, at least at noon and in the afternoon, especially in February and March, while in the early hours of the day, fog can still linger on. Even in this season, sometimes low cloud banks can form, albeit more rarely. The temperature is pleasantly warm, with highs around 26 °C from January to March.
Here are the average temperatures of Lima.
Average temperatures - Lima
Min (°C)191919181615151515151618
Max (°C)262726242220191819202224

In Lima, the sea is never very warm, even though it becomes acceptable for swimming from January to March.
Sea temperature - Lima
Sea (°C)222322211919181717171921

In the northern part of the coast, the sea is slightly warmer, and the temperature ranges from 25 °C in February and March, to 21 °C from August to October.
The northern part of the coast (regions of Tumbes and Piura, see Tumbes, Máncora, El Alto, Talara, Paita), may experience a bit of rain from January to May, around 50-100 millimetres per year. The phenomenon known as El Niño, which is an abnormal warming of ocean waters, can influence this part of the coast (even a little further to the south, up to the region of Lambayeque, see Chiclayo), bringing a warmer weather and unusual rainfall in the years in which it occurs. During the most intense years of El Niño (such as 1983 or 1998), the climate of this area can be transformed, in the first months of the year (from January to May, but sometimes also in the previous December and in June), turning into tropical, hot and humid, with almost monsoonal rains, especially in the northernmost part.
In Lima, usually it does not rain even during these periods, but the torrents that descend from inland can swell, causing floods and landslides. Furthermore, the air temperature can exceed 30 °C in summer, and the sea temperature can exceed 25 °C.

Peru, climate of the Andes
The Andes cross Peru from north to south, sharply separating the coast from the Amazon forest. Here the climate varies with altitude and slope exposure. There are several high peaks, among which Huascaran, with its 6,768 metres high, Yerupajá, 6,617 metres high, and Coropuna, 6,425 metres high. Eternal snows are found at about 5,000 metres.
In the Andean Plateau, home to several modern cities but also the ruins of pre-Columbian civilizations, there is a rainy season from September to May, and a dry season from June to August (but in the far south the rainy season is shorter, so that there is little rain even in September and May). In contrast with the coast, the plateau in the dry season is sunny. The tropical sun rays are very strong, especially at high altitude, hence they raise a lot of the daytime temperature, but at night with clear skies it can get cold, even with possible frosts, especially in the south, which lies farther from the Equator, and thus has a cooler winter.
In the Andean region, rainfall varies depending on slope exposure.
The western side is desert, and here it hardly ever rains: in Arequipa, at 2,500 metres above sea level, less than 100 mm of rain fall on average each year. Here is the average precipitation.
Average precipitation - Arequipa
Prec. (mm)30352010002101595

The temperature is mild, with cold nights, throughout the year, but especially from May to September.
Average temperatures - Arequipa
Min (°C)999766666778
Max (°C)222121222221212222232322

The area of Nazca, where the famous and mysterious Nazca Lines are found, is also a desert (called Nazca or Sechura Desert), and is located around 500 metres above sea level, so it's not in the Andes, but halfway between the Andes and the coast, where you can find hot temperatures during the day.
The plateau is generally arid, or at most moderately rainy: on average, from 350 to 800 millimetres of rain per year fall; rainfall is a bit more abundant in the north, where the rainy season is longer.
The eastern mountain range, called Cordillera Oriental, is rainier than the western one.
The daytime temperatures in the Andean area do not vary by much during the year, while the nights are colder in the winter months, especially in the south. At night, the temperature can drop below freezing above 3,000 metres, from May to August.

Machu Picchu

In Cusco, the ancient capital of the Inca empire, located at 3,400 metres above sea level, the maximum temperatures vary little throughout the year: from 19 °C from January to July, to 21 °C in October and November (the spring months, which come before the rainy season, are the warmest), while the minimum temperatures fluctuate more: from 7 °C in the period from December to February (which are the summer months) to 1 °C in June and July.
From May to August, it almost never rains, while about 700 millimetres of rain fall per year, almost all in the period from October to April, and especially from December to March, when rainfall is more frequent and abundant.
Here is the average precipitation.
The famous archaeological site of Machu Picchu, located at about 2,500 metres above sea level, is a little milder.
On the shores of Lake Titicaca, divided between Peru and Bolivia, at 3,800 metres above sea level, the climate is colder than in Cuzco, so much so that from May to September there are frequent frosts. In winter, when clear skies prevail, the range between night and day is remarkable, so that during the day the temperature is similar to that of the summer months. Here are the average temperatures of Juliaca.
Average temperatures - Juliaca
Min (°C)3331-3-6-7-5-1023
Max (°C)171717171716161717181918

In the north, in Cajamarca, at 2,600 metres, the temperature is milder, around 13/15 °C throughout the year, but with a high diurnal range: lows are a few degrees above freezing in winter, and below 10 °C in summer, while highs are just above 20 °C all year round.
Average temperatures - Cajamarca
Min (°C)777653345666
Max (°C)222121212221212222222222

The rainiest period runs from October to April. Here is the average precipitation.
Average precipitation - Cajamarca
Prec. (mm)10095135954520171740958075810

Peru, climate of the Amazon rainforest
In the vast area of plains and hills of eastern Peru, belonging to the Amazon Basin, there is a impenetrable rainforest, almost completely uninhabited. The northern region has an equatorial climate, hot and humid all year round, with frequent rainfall, while in the south the climate becomes tropical, with a relatively dry season in winter.
In Iquitos, in the north, almost 3,000 mm of rain per year fall; the only months when the rainfall decreases a bit are July and August, with around 150 mm of rain per month. The tropical rains usually occur in the afternoon and in the form of downpour or thunderstorm. Here is the average precipitation.
Average precipitation - Iquitos
Prec. (mm)2552753503052702001651551902152452552840

The temperatures in this northern part of the Amazon are steadily high all year round.
Average temperatures - Iquitos
Min (°C)222222222222212121222222
Max (°C)313231313030303132323231

Moving south, the relatively dry season in the Southern Hemisphere winter becomes more evident: in Pucallpa, in the central area, just 50/60 mm of rain per month fall in the period from June to August, while in the southern part, in Puerto Maldonado, the least rainy season extends from May to September. Here during winter there is also a decrease in temperature, so that the minimum goes down to about 15 °C on average.
The highest rainfall amount is recorded in the eastern slope of the Andes, where the mountains descend to the Amazon rainforest. Quince Mil, at 650 metres above sea level, on the north side of the Cordillera Oriental, receives 6 metres and a half of rain per year! Here the "best" period is from May to September, when "only" 300 to 350 mm of rain fall per month.

Travel-when to go

It's not possible to find a single period in which the whole Peru offers its best weather, because the best time in the Andean areas and in the Amazon is the Southern Hemisphere winter (June to August), while along the coast during this period the weather is cool, cloudy and foggy. To find a warm and sunny weather, along the coast and in Lima, the best time is from December to April, and for swimming in particular the best period is from January to March.

What to pack

In winter (June to August): for Lima and the coast, clothes for spring and autumn, a sweatshirt or sweater and a jacket. For the Amazon, loose fitting, light clothing, possibly with long sleeves for mosquitoes; a sweatshirt for the evening; a sweater and a jacket for the evening in the southern part (see Puerto Maldonado), and also for the hilly part of the Amazon. For the Andes, in towns at around 2,500/4,000 metres, like Cuzco, Arequipa and Lake Titicaca, clothes for spring and autumn for the day, as well as a sweater, warm jacket and hat for the evening; sun hat, sunscreen, hiking shoes. For the highest peaks, down jacket, scarf, gloves, warm boots.

In summer (December to February): for Lima and the coast, light clothing, a sweatshirt for the evening, umbrella or light raincoat north of Lima for the years of El Niño, a light jacket for the southern part of the coast. For the Amazon, tropics-friendly, loose fitting clothing, of natural fibres (cotton, linen) or synthetics that breathe, maybe with long sleeves for mosquitoes; sweatshirt or light jacket for the evening in the hilly part of the Amazon. For the Andes, in towns at around 2,500/4,000 metres, like Cuzco, Arequipa and Lake Titicaca, clothes for spring and autumn, light for the day, as well as sweater, jacket and hat for the evening; sun hat, sunscreen, umbrella or raincoat, hiking shoes. For the highest peaks, down jacket, scarf, gloves, warm boots.