Investigators were still analysing the content and the results may take a few days, a spokesman for Madrid's SAMUR municipal rescue service told AFP.
"An envelope arrived with a suspicious white substance potentially carrying a biological or chemical risk," he said.
The incident happened at a post office located inside the Spanish capital's Cybele Palace, which also houses Madrid's city hall.
A police source said there was a strong possibility the package was harmless, but he stressed: "We have to wait for the (test) results."
A postal worker had touched the envelope but did not open it after spotting the substance through the transparent window film on the front, the SAMUR spokesman said.
"As a precaution, the 23 people who were inside the post office, six customers and staff members, have been decontaminated," he added. "They are in good health."
Some 50 emergency workers and firefighters were called to the scene, as well as around a dozen police officers.
All of them also went through the standard decontamination procedure to prevent any possible harmful effects from the unknown substance, the spokesman said.