Lenz's law states that the polarity of induced emf is such that it tends to produce a current with opposes the change in magnetic flux that produces it.
The following experiment shows that Lenz's law is based on conservation of energy. The experiment is carried out with a bar magnet NS and a coil C connected to a sensitive galvanometer G as shown in the adjoining figure.
When the bar magnet is suddenly moved towards the coil pointing its N pole towards the coil, galvanometer indicates deflection showing that the electric current is flowing in the coil [Fig. (a)]. If the motion of the magnet ceases, the needle of the galvanometer returns to zero mark indicating that the current in the coil has stopped. If the magnet is carried away from the coil quickly the galvanometer shows a deflection but in the opposite direction to that of Fig. (a) [Fig. (b)]. When the bar magnet is suddenly moved towards or away from the coil pointing its S pole towards the coil the deflection in the galvanometer is opposite to that observed in fig. (a) and fig. (b) respectively. This is shown in fig. (c) and fig. (d), respectively.

In this experiment, it is clear that in each case in order to move the bar magnet some mechanical work has to be done against the opposing force and the electrical energy obtained is the coil is equivalent to this work obeying law of conservation of energy.
It should also be noted here that if the direction of induced current in the coil does not oppose the motion of the magnet, then electric energy will be obtained without doing any work which is impossible. Hence Lenz's law is in accordance with law of conservation of energy.