The new law, which has been dubbed the "right to disconnect", comes into force on 1 January.
Companies with more than 50 workers will be obliged to draw up a charter of good conduct, setting out the hours when staff are not supposed to send or answer emails.
France has a working week of 35 hours, in place since 2000.
Supporters of the new law say that employees who are expected to check and reply to their work emails out of hours are not being paid fairly for their overtime, and that the practice carries a risk of stress, burnout, sleep problems and relationship difficulties.
The measure is part of a set of labour laws introduced in May.
It was the only one of the laws - which also made it easier for firms to hire and fire employees - that did not generate widespread protest and strikes.
Some private companies have previously tried to put limits on their employees' use of work email outside working hours.
For instance, in 2014, the German vehicle-maker Daimler set up an optional service for workers going on holiday; instead of sending an out-of-office reply, they could opt to have all new emails automatically deleted while they were away.