Normal sunglasses do not work. Neither does an X-ray, a CD, a tinted glass, nor similar homemade solutions.
To directly observe the solar eclipse on Wednesday, August 12, the National Geographic Institute recommends using only specific glasses certified according to the EN ISO 12312-2:2015 standard and, if purchased in the European Union, with CE marking.
Check the glasses before putting them on
The filter must be in perfect condition. If it is scratched, perforated, detached, or shows any deterioration, it should not be used.
The glasses must properly cover the field of vision. First, they should be put on and then the gaze directed towards the Sun, never the other way around.
The IGN adds another precaution that may go unnoticed: even when using certified glasses, it does not recommend looking directly at the Sun for more than one minute at a time.
When they can be removed during totality
The glasses must be kept on during all partial phases. Only those situated within the totality strip will be able to remove them during the brief period when the Sun is completely hidden.
Outside of that strip, the eclipse will remain partial and protection must be maintained throughout the observation.
The eclipse will be exceptional. It will be the first total one visible from the Iberian Peninsula in over a century and the totality strip will cross Spain from west to east, passing through areas that include A Coruña, Asturias, León, Bilbao, Zaragoza, Valencia, and the Balearic Islands. Madrid will be outside of totality and will be observed as partial.
One last warning: eclipse glasses also should not be used as a filter placed in front of binoculars, cameras, or telescopes. Observing with optical instruments requires solar filters specifically designed for those devices.