Democratic Gov. Martin O'Malley signed the measure at a crowded ceremony on Thursday. Attending was one-time Maryland death row inmate Kirk Bloodsworth. He is the first person in the U.S. freed because of DNA evidence after being convicted in a death penalty case.
Maryland is the 18th state to abolish the death penalty.
The bill will not apply to the five men the state has on death row, but the governor can commute their sentences to life without parole. O'Malley has said he will consider them on a case-by-case basis.
The state's last execution was in 2005.
Supporters of the death penalty could still try to petition the bill to the ballot.