A weekend deluge pounded the states of Rio de Janeiro and Espirito Santo, where authorities described a chaotic situation due to flooding.
The death toll in Espirito Santo rose from four to 17 as rescuers advanced, aided by water levels that had dropped overnight as the rainfall temporarily subsided.
The most affected municipality was Mimoso do Sul, a town of almost 25,000 inhabitants in the south of Espirito Santo, where flooding has killed at least 15 people.
Two more people died in the municipality of Apiaca.
State Governor Renato Casagrande described the situation as “chaotic”, though falling water levels were allowing rescuers to make their way to previously inaccessible areas.
At least 5,200 people have been evacuated from their homes, state authorities said.
In the neighbouring state of Rio de Janeiro, at least eight people have been killed, officials said. Four were killed when a house collapsed in the city of Petropolis, 70km (43 miles) inland from the state capital.
The deluge came after Brazil suffered a string of extreme weather events.
Such environmental tragedies “are intensifying with climate change”, President Luiz Inacio Lula da Silva said in a post on social media platform X, noting the thousands left homeless by the storm.
Expressing sympathy for the victims, Lula said his government was working with state and local authorities to “protect, prevent and repair flood damage”.
The National Institute of Meteorology had predicted a severe storm, particularly in Rio, with rainfall of 200mm (7.9 inches) a day from Friday through Sunday. Normally, the area receives 140mm (5.5 inches) of rain in all of March.
Rio authorities had declared an administrative holiday on Friday as the storm approached and urged people to stay home.
The storm follows a record heatwave, when humidity helped send the heat index soaring above 62 degrees Celsius (143.6 degrees Fahrenheit).