There is a chance the AIDS epidemic can brought under control by 2030, according to a report by the United Nations Aids agency.
It said the number of new HIV infections and deaths from AIDS were both falling.
However, it called for far more international effort as the “current pace cannot end the epidemic”.
And charity Medecins Sans Frontieres warned most of those in need of HIV drugs still had no access to them.
The report showed that 35 million people around the world were living with HIV.
There were 2.1 million new cases in 2013 – 38% less than the 3.4 million figure in 2001.
AIDS-related deaths have fallen by a fifth in the past three years, standing at 1.5 million a year. South Africa and Ethiopia have particularly improved.
Many factors contribute to the improving picture, including increased access to drugs. There has even been a doubling in the number of men opting for circumcision to reduce the risk of spreading or contracting HIV.
While some things are improving, the picture is far from rosy.
Access to antiretroviral drugs is still an issue
Fewer than four in 10 people with HIV are getting life-saving antiretroviral therapy.
And just 15 countries account for three-quarters of all new HIV infections.
The report said: “There have been more achievements in the past five years than in the preceding 23 years.
“There is evidence about what works and where the obstacles remain, more than ever before, there is hope that ending AIDS is possible.
“However, a business-as-usual approach or simply sustaining the AIDS response at its current pace cannot end the epidemic.”
Michel Sidibe, the executive director of UNAIDS, added: “If we accelerate all HIV scale-up by 2020, we will be on track to end the epidemic by 2030, if not, we risk significantly increasing the time it would take – adding a decade, if not more.”
Dr Jennifer Cohn, the medical director for Medecins Sans Frontieres’ access campaign, said: “Providing life-saving HIV treatment to nearly 12 million people in the developing world is a significant achievement, but more than half of people in need still do not have access.”
In Nigeria, 80% of people do not have access to treatment.
Dr Cohn added: “We need to make sure no-one is left behind – and yet, in many of the countries where MSF works we’re seeing low rates of treatment coverage, especially in areas of low HIV prevalence and areas of conflict.
“In some countries, people are being started on treatment too late to save their lives, and pregnant women aren’t getting the early support they need.”