Chelsea Manning, the US soldier jailed for passing data to WikiLeaks, says she has ended a hunger strike because the Army has agreed to provide her with gender transition surgery.
Psychologists recommended in April that she should receive the treatment, commonly known as a sex change.
The move comes after the US military in July lifted a ban on transgender people in the armed forces.
The 28-year-old was convicted in 2013 of leaking secret documents.
"I am unendingly relieved that the military is finally doing the right thing. I applaud them for that. This is all that I wanted - for them to let me be me," Ms Manning said in a statement.
The US Army has so far declined to comment.
But the American Civil Liberties Union (ACLU), which represented Ms Manning, confirmed that she would be provided with medical treatment.
ACLU lawyer Chase Strangio, said: "This is a monumental day for Chelsea, who can now enjoy some peace knowing that critically needed medical care is forthcoming.
"Thankfully the government has recognised its constitutional obligation to provide Chelsea with the medical care that she needs."
Chelsea Manning began her hunger strike on Friday, saying she was being bullied by the US government and denied treatment for gender dysphoria - the sense of one's gender being at odds with one's sex at birth.
In July she attempted suicide over the lack of treatment.
She will now be treated under the US military's new transgender policy, which also allows troops to transition gender while serving and aims to set standards for medical care.
However her campaign team said she could still face being put in solitary confinement as punishment for having tried to commit suicide.
Ms Manning, who was arrested as Bradley Manning, is serving a 35-year sentence at the all-male Fort Leavenworth military facility in Kansas.
She was convicted in a military court of leaking more than 700,000 secret files to Wikileaks after having worked as an intelligence analyst in Iraq.
Shortly afterwards she announced she would start living as a woman.