Map from Google - Rio_de_Janeiro

In Rio de Janeiro, a big city in Brazil and capital of the state of the same name, the climate is tropical, with a relatively cool season from May to October, and a hot and muggy season from December to March, with November and April as intermediate months. The average July temperature is 21.5 °C (70.5 °F), that of January and February is 27 °C (81 °F).
The city lies on the coast: the famous beaches of Copacabana and Ipanema are located along the coast of the Atlantic Ocean, while the city is facing the Guanabara Bay, where there is also the Rio de Janeiro-Galeao airport, named after Antônio Carlos Jobim. Around the city there are forest-covered hills, reaching about a thousand metres of altitude. The Corcovado Mountain, or Monte Cristo, on top of which is the famous statue of Christ the Redeemer, is 710 metres (2,329 feet) high, this means that on the top the temperature is about 4 degrees Celsius lower than on the plains. The Sugarloaf Mountain, reached by a cable car with stunning views, is instead at the entrance of the bay, and is 396 metres (1,300 feet) high.
Here are the average temperatures (recorded along the coast, in the Saúde district).
Average temperatures - Rio de Janeiro
Rio de JaneiroJanFebMarAprMayJunJulAugSepOctNovDec
Min (°C)232423222019181919202122
Max (°C)293029282625252625262729
Min (°F)737573726866646666687072
Max (°F)848684827977777977798184

Although the average temperatures are not very high, and thankfully there are usually breezes relieving the heat, sometimes in summer very hot days may occur, with highs around 35/37 °C (95/99 °F), from October to April; however, summery days can also occur in winter, with highs around 30/32 °C (86/90 °F) even in June, July and August.
On the other hand, during the cool season, from May to October, cool air masses of Antarctic origin can bring cool temperatures, or even a little cold at night, so that the minimum temperatures can drop to around 10/12 °C (50/54 °F), and highs can stay around 18/20 °C (64/68 °F). This happens in the city proper, in the districts lying along the coast, but in the localities of the metropolitan region situated to the north-west and far from the sea, like Nova Iguaçu, lows can drop even below 10 °C (50 °F).

The cable car to Sugar Loaf

The rains amount to around 1,050 millimetres (41.3 inches) per year, so they are relatively abundant; the wettest season is summer, from December to March (remember that the city is located in the southern hemisphere), when the rains occur mainly in the form of showers or thunderstorms. The winter season is quite dry, but sometimes some disturbances can pass, bringing some days of bad weather, and also cool temperatures: this happens mostly in winter (during the months of June, July and August), but can also occur in the months of May, September and October.
Here is the average precipitation.
Average precipitation - Rio de Janeiro
Rio de JaneiroJanFebMarAprMayJunJulAugSepOctNovDecYear
Prec. (mm)135130135957045404555851001351070
Prec. (in)

The amount of sunshine in Rio is good, but not great. In summer, the sky is often clear or partly cloudy, but some cloud banks can form, more or less intense, as mentioned, associated with showers and thunderstorms: there are on average seven hours of sunshine per day from January to March. In winter, the relatively dry season, as I said there can be some cloudiness linked to winter depressions: there are about 6 hours of sunshine per day from June to August, and 5 in September and October.

The sea is warm enough for swimming from November to May, when its temperature is equal to or higher than 24 °C (75 °F), or even in June (when it comes down to 23 °C or 73 °F); from July to October it is a bit cool, but all in all still acceptable, since it remains around 22 °C (72 °F).
Here are the average sea temperatures.
Sea temperature - Rio de Janeiro
Rio de JaneiroJanFebMarAprMayJunJulAugSepOctNovDec
Sea (°C)252626252423222222222425
Sea (°F)777979777573727272727577

When to go

The best time to visit Rio de Janeiro is winter, from May to October: the temperatures are generally pleasant, with quite rare rains. It will be possible to pass a relaxing time on the beaches, to sunbathe, and to try to swim in a sea a little cool. A sweatshirt and a light jacket can help for the evening and on cloudy and cool days.
In summer the weather is hot and muggy, sometimes very hot, and thunderstorms can break out, but there is also a lot of sunshine. As there is no danger of the passage of cyclones, if you want you can go also in this season, at least if you do not suffer from the heat, and you have in mind long periods on the beach. It may be useful to book a hotel with air conditioning, and bring a sweatshirt or a pashmina for airconditioned places.