Following a five-month campaign by his supporters to get him out, the state Supreme Court directed a Philadelphia judge who had jailed him to immediately issue an order releasing him on unsecured bail.
Mill was sentenced in November to 2-4 years in prison for probation violations.
Mill was taken from the prison by helicopter. Earlier, scores of people gathered outside the prison near Philadelphia in hopes of seeing him walk free.
A team of lawyers and public relations consultants had waged an all-out battle to get him freed, leveling fierce criticism at the judge as a stream of high-powered figures and celebrities visited him in jail outside Philadelphia, including actor Kevin Hart just hours before the Supreme Court ruling.
Mill issued a statement saying the past months had been "a nightmare," and thanked his many supporters and visitors, who included Philadelphia Mayor Jim Kenney and New England Patriots owner Robert Kraft.
"Although I'm blessed to have the resources to fight this unjust situation, I understand that many people of color across the country don't have that luxury and I plan to use my platform to shine a light on those issues," Mill said.
He said he would now focus his attention on getting his convictions overturned, and that he looks forward to resuming his music career.
Earlier this month, in a major victory for Mill, prosecutors said they agreed with his lawyers that he should get a new trial because of questions raised about the arresting officer. The now-retired officer was among a list of police officers the prosecutor's office has sought to keep off the witness stand in cases across the city because of credibility questions.
A spokesman for District Attorney Larry Krasner said late Tuesday that the Supreme Court's decision on Meek Mill's release was consistent with the position taken by their office.
Mill's attorney, Joe Tacopina, thanked the high court.
"Meek was unjustly convicted and should not have spent a single day in jail," Tacopina said.
In an opinion earlier this month, Judge Genece Brinkley, who sent Mill to prison for the probation violations, strongly defended herself against accusations by the defense she was waging a vendetta against the rapper. She said the court "has impartially and without prejudice presided over numerous proceedings in this matter since 2008."
The Supreme Court denied a defense request to move the case to another judge, but said the presiding judge could opt to remove herself.