Parliament has given the green light to government plans to gradually open up the electricity market, giving industrial consumers and private households the freedom to choose their power suppliers.
The new law is in line with the government's policy of bringing Swiss legislation into line with that of the European Union.
Under the bill, consumers will be able to choose their electricity supplier within six years of the legislation being put into effect. Utilities will also be able to shop around for cheaper electricity.
As part of the new law, a national network company is to be established to ensure that all suppliers have access to the grid.
Both houses of parliament on Wednesday also agreed to allow hydroelectric operators to obtain loans for the next 10 years to soften the impact of the liberalisation.
Switzerland has more than 1,200 electricity utilities. More than 55 per cent of the country's electricity comes from hydroelectric plants, with about 40 per cent generated by nuclear power stations.
Under the new law, small suppliers of eco-friendly produced electricity are to be given free access to the electricity grid.
Trade unions and other groups in the French-speaking part of the country have threatened to challenge the law in a nationwide ballot. They argue that the pace of liberalisation is too fast.
The energy minister, Moritz Leuenberger, told parliament that he was confident that voters would support the new law.
swissinfo with agencies