The legislation is intended to stop groups offering the service - which claims to be able to change a person's sexual orientation - to under-18s.
Those breaking the new law can face up to a year in prison, or a €30,000 ($32,535; £26,268) fine.
Research suggests the controversial practice can lead to depression and increase the risk of suicide.
Under the law, passed on Thursday evening, minors will not be allowed to take part in medical interventions aimed at changing or suppressing their sexual orientation or gender identity.
Parents and legal guardians can also be punished for making their children take part through deception, coercion or threats.