Many died while trying to flee the Pedrógão Grande area, central Portugal, in their cars.
He reported that at least 18 people were "burned to death in their cars", while several others died from smoke inhalation.
Sixteen people were injured, including five firefighters.
"This is a region that has had fires because of its forests, but we can not remember a tragedy of these proportions", said Valdemar Alves, mayor of Pedrogao Grande.
A forest fire in central Portugal killed 19 people and injured at least 20 others Saturday, majority as they tried to escape the blaze in their cars, the government said.
Costa also took to Twitter to thank rescue workers for their efforts to control the blaze, and send condolences to the victims who died.
More than 50 fires are said to be burning across the country involving about 2,000 firefighters after intense heat combined with strong winds to fan the flames.
Avelar resident Isabel Brandao blamed it on the lack of rain.
He said it was thought to have been sparked by a lightning strike.
"Unfortunately this seems to be the greatest tragedy we have seen in recent years in terms of forest fires". There were 156 fires on Saturday, he said.
Forty-seven bodies were discovered in or adjacent to their cars, El Hammar told ABC News.
Authorities said the the conditions may have played a part.
A stream in Penela reflects the wildfire raging in central Portugal on Sunday. Government officials said an assessment will be made of the cause.
The number of people killed in the wildfire southeast of Coimbra, Portugal has risen to at least 62, according to the BBC.