Map from Google - Peru

In Peru, a country located just south of the Equator, there are three climate zones: a desert coastal strip (called 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 during 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 raincloud formation. 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 sunshine prevails above 500 metres (1,600 feet), as happens in the Andean area lying above the foggy layer.
The daily average temperature ranges from 18 °C (64 °F) in the coldest month (August), to 24 °C (75 °F) in the warmest month (February) in the north (see El Alto), from 17 °C to 23 °C (63 to 73 °F) in the centre (see Lima and Trujillo), and from 15 °C to 22 °C (59 to 72 °F) 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; temperatures are mild, with highs around 18 °C (64 °F), and lows only a few degrees below, but for the lack of sunshine and the high humidity, residents of the capital feel cold, also because they often live in unheated homes. 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 banks of low clouds can form, albeit more rarely. The temperature is pleasantly warm, with highs around 26 °C (79 °F) from January to March.
Here are the average temperatures.
Average temperatures - Lima
Min (°C)191919181615151515151618
Max (°C)262726242220191819202224
Min (°F)666666646159595959596164
Max (°F)798179757268666466687275

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
Sea (°F)727372706666646363636670

In the northern part of the coast, the sea is slightly warmer, and the temperature ranges from 25 °C (77 °F) in February and March, to 21 °C (70 °F) 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 (2/4 inches) per year (but even more in the far north, see Tumbes). 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, air temperature can exceed 30 °C (86 °F) in summer, and sea temperature can exceed 25 °C (77 °F).

Peru, climate of the Andes
The Andes cross Peru from north to south, clearly 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 (22,205 feet), Yerupajá, 6,617 metres (21,709 feet), and Coropuna, 6,425 metres (21,079 ft). Eternal snows are found at about 5,000 metres (16,500 ft).
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 it rains little even in September and May). In contrast with the coast, the plateau in the dry season is sunny. The tropical sun's 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 it rains very rarely: in Arequipa, at 2,500 metres (8,200 ft) above sea level, less than 100 mm (4 in) 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
Min (°F)484848454343434343454546
Max (°F)727070727270707272737372

Even the area of Nazca, where the famous and mysterious Nazca Lines are found, is desert, and is located around 500 metres (1,600 feet) 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 (14 to 31.5 inches) 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.
Daytime temperatures in the Andean area do not vary by much during the year, while nights are colder in the winter months, especially in the south. At night, the temperature can drop below freezing (0 °C or 32 °F) above 3,000 metres (9,800 ft), from May to August.

Machu Picchu

In Cusco, the ancient capital of the Inca empire, located at 3,400 metres (11,100 feet) above sea level, maximum temperatures vary little throughout the year: from 19 °C (66 °F) from January to July, to 21 °C (70 °F) in October and November (the spring months, which come before the rainy season, are the warmest), while minimum temperatures fluctuate more: from 7 °C (45 °F) in the period from December to February (which are the summer months), to 1 °C (34 °F) in June and July.
Average temperatures - Cusco
Min (°C)776531125667
Max (°C)191919191919192020212120
Min (°F)454543413734343641434345
Max (°F)666666666666666868707068

About 700 millimetres (27.5 in) of rain per year fall, almost all in the period from October to April, and especially from December to March, when rainfall is more frequent and abundant, while from May to August it almost never rains.
Here is the average precipitation.
Average precipitation - Cusco
Prec. (mm)14513510545102510204070125712

The famous archaeological site of Machu Picchu, located at about 2,500 metres (8,200 ft) above sea level, is a little milder.
On the shores of Lake Titicaca, shared between Peru and Bolivia, at 3,800 metres (12,500 ft) above sea level, the climate is colder than in Cuzco, so much so that from May to September there are frequent night frosts. In winter, when clear skies prevail, the temperature 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
Min (°F)373737342721192330323637
Max (°F)636363636361616363646664

In Juliaca, 665 mm (26 in) per year fall, with a pattern similar to that of Cuzco.

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

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 occupied by 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, 2,850 mm (112 in) of rain per year fall; the only months when the rainfall decreases a bit are July and August, with around 150 mm (6 in) 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
Min (°F)727272727272707070727272
Max (°F)889088888686868890909088

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

When to go

It's not possible to find a single period in which the whole of 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, at around 2,500/4,000 metres (8,000/13,000 feet), like in Cuzco, Arequipa and Lake Titicaca, clothes for spring and autumn for the day, as well as 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, at around 2,500/4,000 metres (8,000/13,000 feet), like in 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.