Obtaining and displaying the Eco Badge is voluntary but some cities and towns have started to use this classification to reduce polution causing congestion.
Early in October, Madrid restricted access to parts of the city, preventing more polluting vehicles from entering, with only those displaying the eco-friendly badge allowed access, or a charge was levied on the vehicle owner, more as a congestion charge rather than a fine.
It is also becoming a requirement in order to sell your vehicle through some companies and so the need is increasing without mandatory enforcement.
The origin of the labels resides in the National Air Quality Plan 2013-16. Its purpose is to classify vehicles according to the pollution they are emitting. The badges can be purchased at any Post Office by taking the vehicle registration certificate, licence plate number and ID of the owner or authorisation of the owner if obtaining it on their behalf. The national vehicle database will be able to ascertain whether your vehicle is suitable for one of the four categories, zero emissions, eco, C or B.
You can also check categorisation for yourself here http://www.dgt.es/es/seguridad-vial/distintivo-ambiental/index.shtml
You should then place the sticker on the lower right corner of the front windscreen (as you look out from inside).