The country is the latest in the EU to introduce plans which will help reduce its dependence on Russian oil and gas by seven per cent.
All public buildings including cinemas, theatres, shopping centres, rail stations and airports will have the new limits in a week’s time.
Heating will not be set above 19C and air conditioning must be above 27C.
Shops will have to keep doors closed to stay energy efficient, while store windows and monuments must switch lights off by 10pm.
The measures will stay in place until November 2023.
“[This] lays out a series of measures to save energy and use it more efficiently, which are urgent and necessary when it comes to reducing energy consumption in general, and reducing our dependence on energy outside the Spanish economy,” a decree published in the official state gazette said.
Teresa Ribera, Spain’s environment minister, said that big companies could encourage staff to work from home more to further save energy used in commutes and in public buildings.
It comes as German city, Hanover, banned hot water and heating in public buildings after Russia cut back its gas supplies to the country last week.
The drastic move - which will also affect swimming pools, sports halls and gyms - comes after Vladimir Putin reduced gas flow to the country by 20 per cent.
Residents of the city have already started to take cold showers as the city’s mayor Belit Onay said they have to reduce energy consumption by 15 per cent due to the “imminent gas shortage”.
While Hanover is the first city to experience the squeeze, more of Germany is expected to follow suit as a significant reduction in gas usage will take place between April and September each year.