Most of the rain falls December through March. The driest time of the year is May through October. In these winter months things cool down considerably, though nighttime temperatures will seldom drop below 20C (68F).
You might think Brazil is always warm, but some regions can get quite wet and chilly if you go in the middle of the year. To get the best weather while avoiding the crowds who fill up the beaches once kids are out of school in the peak season you should visit Brazil in either October or November.