Map from Google - Brazil

Brazil is a huge country and has different climates, although it can be divided into three main climatic regions: equatorial with year-round rains (the Amazon Basin plus a small coastal area), almost Mediterranean with temperate winters and hot summers (the extreme south), and finally tropical with a dry season (the vast central area, plus a small northern portion). Northern Brazil is crossed by the Equator, so that south of the Equator, that is in the majority of the country, the seasons are reversed compared with Europe or North America. In the tropical zone, the rainy season is almost always the austral summer.

Areas having an equatorial climate
In a large area of northern Brazil, covered by the Amazon rainforest, the climate is equatorial, hot and humid with year-round rains. The rains come in the form of heavy showers and thunderstorms in the afternoon or evening. The total annual rainfall is considerable, from 2,000 to 3,000 millimetres. The rains are more abundant from December to May, when they easily exceed 200 mm per month, but often even 300 mm. Within the forest, the temperature remains below 30 °C even during the day, but moisture is consistently close to 100%. The cities built in the area, after removing a part of the forest, are a bit warmer, because of course the sun rays are able to reach the ground.
For example, in Manaus, in the middle of the forest, the maximum daytime temperature is around 30/32 °C all year round, but it can reach 35/37 °C in the hottest days; the air is almost always moist. Rainfall amounts to 2,300 mm per year, of which more than 200 mm per month from December to May, while there's a drier period, with less than 100 mm per month from July to September.
Here is the average precipitation in Manaus.
Average precipitation - Manaus
Prec. (mm)2602903153002551159060851251852152285

Even in Belém it's hot and humid all year round, but at least the city is located near the coast, so it receives a bit of a breeze from the sea.
Here are the average temperatures of Belém.
Average temperatures - Belém
Min (°C)222222222322222222222222
Max (°C)313130313132323232323232

Here the rains are more abundant than in Manaus, and the trend is similar, although the relatively less rainy period is moved forward, reaching a low in October and November. Here is the average precipitation in Belém.
Average precipitation - Belém
Prec. (mm)34040543534528517514512512090851752725

The least rainy period runs from August to November in the northern part of the Amazon, and from June to September in the south-central part, but as mentioned there's not a really dry season, because heavy rains are always possible in the afternoon, they are just rarer in the less rainy season. As a result, in this season the hours of sunshine increase a bit, even though their percentage is never too high, because some cloudiness frequently develops.
A climate of this kind, hot and humid with year-round rains, is also found in a relatively small area along the eastern coast (see the small circle in the map), in the area of Salvador de Bahia, which receives 1,900 mm of rain per year. Here the rains are frequent and abundant especially from April to early August.
Here is the average precipitation.
Average precipitation - Salvador
Prec. (mm)75115165280295225205115951001151251910

The temperatures drop slightly during the winter months, from June to August, when highs are around 26/27 °C. The reason why in this stretch of coast it rains throughout the year, is to be found in the trade winds that pick up moisture over the sea, however, downpour and thunderstorm don't last long, so that the sunshine amount remains high, especially from October to March, when there are about 8 hours of sunshine per day on average. In addition, along the coast the sea breeze tempers the heat even in the warmest months. Therefore, the climate of Salvador de Bahia is better than that of the Amazon forest. To explore this fascinating city and hang out at the beaches, you may prefer the period from October to January.
Average temperatures - Salvador
Min (°C)242424232322212122232323
Max (°C)303030292827262627282929

In Salvador, the sea is warm all year round, as you can see in the following table.
Sea temperature - Salvador
Sea (°C)282828282827262626262727

Areas having a tropical climate
In this vast area including most of the central and southern Brazil, the climate is tropical, with a dry season (usually from May to August) and a rainy season (typically from October to March, with the peak in mid-summer, between December and February). In the areas where the dry season is shortest, the forest can grow as happens in the equatorial zone, otherwise the vegetation is less dense and savanna-type, with characteristics of more or less pronounced aridity (presence of shrubs, cacti, etc..). For example, in inland areas of the states of Bahia and Pernambuco, precipitation decreases to 400/500 mm per year, and there are many days with intense heat, especially between August and November. However, the rainfall in inland areas of the Nordeste are very irregular, so even though the average is not very high, in the period from November to March, in some years there may be even torrential rains.
Anyway, in many places, the altitude, between 500 and 1,000 metres in many eastern areas, tempers the heat a little.

In the far north of Brazil, where the Massif of Guyana is located (see the circled area in the top of the map), we find another area covered by savannah, north of the vast Amazon rainforest. Here we are, albeit slightly, north of the Equator, so the driest period, which is usually the Northern Hemisphere winter, is reversed. In the nort of the state of Roraima, on the border with Venezuela and Guyana, the least rainy period goes from October to March.
Here is the average precipitation in Boa Vista, capital of the state of Roraima.
Average precipitation - Boa Vista
Boa VistaJanFebMarAprMayJunJulAugSepOctNovDecYear
Prec. (mm)2020501302703603302201006060301650

In Boa Vista, the heat is felt throughout the year; in the dry season the temperatures are higher, but the relative humidity is lower.
Here are the average temperatures.
Average temperatures - Boa Vista
Boa VistaJanFebMarAprMayJunJulAugSepOctNovDec
Min (°C)232324242322222323242423
Max (°C)333334333130303233343333

Further east, in the northern part of the state of Amapá, the least rainy period is shorter and runs from September to November.

Moving down to the greater tropical area, we will follow the rainfall pattern along the coast, which compared with the inland areas is more variable, and determines the best time to visit the different areas.
In the Northeast, east of Belém (which is still part of the equatorial zone), we find cities like Sao Luis, where the dry season runs from August to November, but all in all in December it doesn't exceed 90 mm, and Fortaleza where it goes from August to December, while in both cases from February to April the rainfall exceeds 200 millimetres per month. In Fortaleza, in the state of Ceará, the year is curiously divided into two, with the first part dry and the second rainy.
Here is the average precipitation in Fortaleza.
Average precipitation - Fortaleza
Prec. (mm)1202053253552551409520251510451610

The temperature in Fortaleza is high throughout the year, but the heat is tempered by breezes. The humidity is higher in the rainy period. Here are the average temperatures.
Average temperatures - Fortaleza
Min (°C)252324232322222323252425
Max (°C)313030302930302929313131

Even in Fortaleza the sea is warm all year round.
Sea temperature - Fortaleza
Sea (°C)282828282828272727272727

Further to the south-east, in Natal, the dry season goes from October to December, but also in September and January the amount of rainfall is usually acceptable. On the contrary, from February to July, more than 300 millimetres of rain per month fall. Similar trend is found in Recife: here the least rainy period runs from October to January, while in Maceió and Aracaju, it goes from October to February. Further south, the coast of the state of Bahia, where Salvador and Ilheus are found, should be excluded because it's part of the equatorial climate zone, of which we have already spoken.
Further south, we find the area of Rio de Janeiro, where the dry season runs from June to August, that is in winter, as happens in many inland areas of this tropical climate area.
Here is the average precipitation.
Average precipitation - Rio de Janeiro
Rio de JaneiroJanFebMarAprMayJunJulAugSepOctNovDecYear
Prec. (mm)135130135957045404555851001351070

Here, however, we are quite in the south, that is, away enough from the equator, to experience a drop in the winter temperature: in Rio the maxima from May to October go down to around 25/26 °C. This can be considered as the best time to visit the city of Rio, because it's warm but not hot, the amount of sunshine is good, and the rains quite rare, even though they are still possible. However, the sea at this time is a bit cool (see below), so for swimming it's better the summer, from January to March, when the heat is intense, with possible heat waves (the temperatures can touch 37/38 °C), heavy rains in the afternoon can occur, but the amount of sunshine is still fairly good and the sea is warm. Not by chance, during this period the Rio Carnival takes place, reflecting the fact that the climate is not so bad even in this period, in fact the heat enhances the vitality of the Brazilian people.
Average temperatures - Rio de Janeiro
Rio de JaneiroJanFebMarAprMayJunJulAugSepOctNovDec
Min (°C)232423222019181919202122
Max (°C)293029282625252625262729

In Rio de Janeiro you can swim all year round, even though the sea becomes a little cool from July to October, when the water temperature drops to 22 °C.
Sea temperature - Rio de Janeiro
Rio de JaneiroJanFebMarAprMayJunJulAugSepOctNovDec
Sea (°C)252626252423222222222425

Rio de Janeiro
Continuing along the coast, south-west of Rio de Janeiro, the climate begins to be rainy all year round (see Santos), but here we enter the area having a sub-tropical climate, where winter get progressively cooler (see below).
Moving to the interior, nearly 900 km from the sea, we find the capital Brasilia, which has a pleasantly warm climate all year round, due to the altitude, in fact the city is located about 1,000 metres above sea level. The daytime temperatures range between 25 and 28 °C throughout the year; the minima at night are more variable, and they are higher from October to March, while they become cooler in winter. At times, from May to August, short outbreaks of cold air coming from the south can lower the night temperature around or even below 5 °C.
Average temperatures - Brasilia
Min (°C)171718171513131516171818
Max (°C)272727272625252728282726

The rainy season runs from October to April, and in particular the period from November to February is very rainy. The best period is the winter, from May to August, which is dry and sunny.
Here is the average precipitation.
Average precipitation - Brasilia
Prec. (mm)24021519012540101015501702402501550

In Goiania, we find a similar climate, being located at 750 metres above sea level, and at no great distance from the capital; here, however, the temperature is slightly higher, and from September to April it can be a little hot. Even Belo Horizonte has a similar climate, since it is located at 850 metres above sea level, but its southern location makes it a bit cooler in winter, averaging around 20 °C in June and July.
At lower altitudes, it's hot in inland areas: for example, in Cuiabá, Mato Grosso, the temperatures can reach 40 °C from August to October, ie in spring, before the rainy season.
South of Cuiabá we find the Pantanal, a vast wetland area, with a large biodiversity.
About 350 kilometres away from the coast, north-east of Natal, lies the Fernando de Noronha archipelago: here it's hot and muggy throughout the year, with a rainy season from February to July, and a dry season from August to January.

Area with a subtropical climate
The southernmost part of Brazil (known as "South Region", composed by the states of Paraná, Santa Catarina and Rio Grande do Sul) has a subtropical climate, with winter temperatures that recalls the Mediterranean climate. Rainfall is well distributed throughout the year: in winter it's more common and abundant than in regions having a tropical climate, though typically not too heavy, but it rains also in summer, so we cannot properly speak of Mediterranean climate.
The megalopolis of São Paulo, which is located north of this area, at 800 metres above sea level, is in the boundary between the tropical and subtropical climate: its average temperature ranges from 23 °C in January and February, to 17 °C in June and July. The rainy season runs from October to March, so the best time to visit this city goes from April to September. The period from June to August, as well as being the coolest, it's the least rainy overall. Here is the average precipitation.
Average precipitation - Sao Paulo
Sao PauloJanFebMarAprMayJunJulAugSepOctNovDecYear
Prec. (mm)2402151607575554540801251452001455

From May to September, sometimes at night the temperature can approach freezing, while from September to March it can sometimes be hot, around 33/35 °C. São Paulo has generally pleasant temperatures, but it is a polluted city, and it's often surrounded by a pall of smog that can obscure the sun.
Average temperatures - Sao Paulo
Sao PauloJanFebMarAprMayJunJulAugSepOctNovDec
Min (°C)191918161412121314151718
Max (°C)272827252322222324252626

Further south, in Curitiba, in the state of Paraná, 900 metres above sea level, winter is cooler, so that the average in June and July is 13 °C. Sometimes at night the temperature can drop to the freezing point, from May to September.
In Florianópolis, further south (at a latitude of 27° S) but on the coast, the average temperature goes from 16.5 °C from June to August, to 25 °C in February.
Average temperatures - Florianópolis
Min (°C)212221181613131415171920
Max (°C)282828252321202121232527

As mentioned, precipitation in the south is quite common even in winter. In Florianópolis, 1,500 mm of rain per year fall, with a maximum in summer and autumn, from September to March, but with nine days of rain and no less than 75 mm per month even in winter. Here is the average precipitation.
Average precipitation - Florianópolis
Prec. (mm)17520018595957595951251251301451545

In Florianópolis, the sea is a bit cold in winter, while it becomes warm enough for swimming from November to April, and particularly warm from January to March.
Sea temperature - Florianópolis
Sea (°C)262626242220191920212324

Further south, in Porto Alegre, in the state of Rio Grande do Sul, the average temperature goes from 15 °C in June and July, to 25 °C in February: therefore, summer is still hot (indeed, it is a bit warmer than in Florianópolis, given the distance from the sea), but winter is a bit cooler.
At this latitude, where summer thunderstorms are a little less frequent, while the winter disturbances pass more often, winter becomes even the wettest season, though not by much, as you can see from the average rainfall of Porto Alegre.
Average precipitation - Porto Alegre
Porto AlegreJanFebMarAprMayJunJulAugSepOctNovDecYear
Prec. (mm)10011010585951351201401401151051001347

In the southernmost part of Brazil, in winter the nighttime temperatures can reach 0 °C even in the plains.
In Rio Grande, at a latitude of 32° S, the average July temperature drops to 13 ° C.
Average temperatures - Rio Grande
Rio GrandeJanFebMarAprMayJunJulAugSepOctNovDec
Min (°C)202019151311101012141618
Max (°C)282726232018161719212326

In Rio Grande, even the temperature of the sea is similar to that of the Mediterranean, and becomes warm enough for swimming only in summer, while in winter it is cold.
Sea temperature - Rio Grande
Rio GrandeJanFebMarAprMayJunJulAugSepOctNovDec
Sea (°C)232423211816141415171922

In inland areas, in cities located at higher altitudes like Lages (950 metres) or Sao Joaquim (1,300 metres), at times even snowfall can occur from June to August.
In the southern tip of the Rio Grande do Sul, the winter averages reach 11/12 °C.
In the Iguaçu Falls, on the border with Argentina and Paraguay, the average in July is 15 °C, and the rains are frequent throughout the year, with a relative minimum in July and August. Summer, from December to March, is hot and muggy, with sunshine and thunderstorms.

When to go

Wanting to find a single period to visit Brazil, you can choose the austral winter, ie from June to August, being usually the coolest, the least rainy and the sunniest period. In the far south, however, winter is rainy, and sometimes it can get cold; as regards the rain, as we have seen there are exceptions even in the north-central, which relate mainly to coastal areas, so for the individual zones you can refer to the foregoing sections.
As we have seen, the sea is warm enough all year round for swimming in north-central Brazil, while it becomes relatively cool from June to October at Rio de Janeiro, and even cold along the coast of Rio Grande do Sul, where it drops to 14 °C in August. Here the sea temperature becomes acceptable, around 23/24 °C from January to March.

What to pack

In winter (June to August): in the Amazon, tropics-friendly, loose fitting clothing, maybe with long sleeves for mosquitoes; a sweatshirt for the evening. In the north-east, from Natal to the south, light clothing, a sweatshirt for the evening, a light scarf for the sea breeze, a light sweatshirt and a light raincoat for thunderstorms; a light scarf and a light sweater for the evening also in Sao Luis and Fortaleza, on windy evenings. In Rio de Janeiro, light clothes for the day, a sweatshirt or sweater and a jacket for the evening, raincoat and umbrella. In Brasilia, Sao Paulo, Florianopolis and the extreme south: clothes for spring and autumn, sweater, jacket, raincoat or umbrella.
In summer (December to February): In the forest and the tropical region, up to Rio de Janeiro: tropics-friendly, lightweight clothing, possibly a light sweater and a light raincoat for thunderstorms, sun hat, possibly sweater and scarf for air-conditioned places. In Brasilia, Sao Paulo and the south: light clothes, a sweatshirt and a light jacket for the evening, raincoat or umbrella.