WASHINGTON — President Trump commuted the sentence on Wednesday of a 63-year-old woman serving life in prison for a nonviolent drug conviction after her case was brought to his attention by the reality television star Kim Kardashian West.

Although short of a full pardon, the decision will free Alice Marie Johnson, who has been locked up in federal prison in Alabama since 1996 on charges related to cocaine distribution and money laundering. Ms. Kardashian West, who learned of the case through a video that went viral on social media, visited Mr. Trump at the White House last week to lobby on Ms. Johnson’s behalf.

“While this administration will always be very tough on crime, it believes that those who have paid their debt to society and worked hard to better themselves while in prison deserve a second chance,” the White House said in a statement announcing the commutation.

Ms. Kardashian West celebrated the decision on Twitter. “BEST NEWS EVER!!!!” she wrote.

In an emailed statement, she thanked Mr. Trump and his son-in-law, Jared Kushner, for showing mercy to Ms. Johnson. “Her commutation and forthcoming release is inspirational and gives hope to so many others who are also deserving of a second chance,” Ms. Kardashian West said.