The law, which must still officially be announced by President Hery Rajaonarimampianina, received unanimous backing from the 82 deputies on Wednesday in the island nation's capital Antananarivo.
While the EU hailed the "historic step" taken by lawmakers, prisoners in Madagascar given capital punishment have since 1958 in practice served life sentences.
Under the new law, which states "no one can be executed," the death penalty will be replaced by forced labour for life.
Madagascar's abolition of the death penalty is "the result of an intense plea from Madagascan and international civil society," the EU's representative in Madagascar said in a statement.
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.