The Climate Change and Energy Transition Law passed Tuesday on the islands also bans new diesel vehicles on the roads from 2025 and new gas vehicles from 2035.
The law is facing a legal challenge at the European Commission from Spanish vehicle manufacturers.
The regional government says the islands are especially vulnerable to global warming, with lower rainfall and more frequent weather extremes that will threaten public health, the water supply and tourism, among other sectors.
The popular islands in the Mediterranean, off eastern Spain, include Ibiza and Mallorca.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.