Superior Court Judge David Lowy vacated a life sentence imposed on Angel Echavarria for the 1994 shooting death of Daniel Rodriguez in Lynn.
Echavarria, dressed in a dark suit, was released from the courthouse to cheers and applause from family and supporters.
He cried and embraced his family, saying he looked forward most to spending time with loved ones.
"They finally made justice. I been through a lot in jail. I'm innocent. I never gave up," Echavarria said, according to the Boston Globe.
More From This Section
Essex County District Attorney Jonathan Blodgett's office said it is currently reviewing the case. It has until May 30 to decide to appeal the judge's decision to grant a new trial.
Echavarria also thanked the Brandeis University institute that helped free him. The new trial was prompted by a decadelong investigation by the Schuster Institute for Investigative Journalism at Brandeis University.
"We are deeply grateful that the criminal justice system has finally recognized that Angel Echavarria never received a fair trial," Florence Graves, the institute's founding director, said in a statement.
The institute found a number of legal problems, including inconsistent testimony from witnesses and poor legal representation from Echavarria's then-lawyer.
The state public defender's office sought a new trial in 2010 based largely on the institute's investigation; a judge granted the new trial April 30.
The state's case against Echavarria was based mostly on eyewitness testimony from the victim's brother, who did not speak English and was a habitual marijuana user, according to the institute.
The eyewitness described the shooter as a 20-year-old, clean-shaven Puerto Rican man with a "stocky" or "chunky" build. Echavarria, from the Dominican Republic, in 1994 weighed just 135 pounds (61 kilograms) and had a full mustache.