The judge in the case said his decision was based on concerns that DNA evidence presented by authorities was tainted.
Sex between males is a criminal offense in mainly Muslim Malaysia, and a conviction could have sent Anwar to prison for up to 20 years.
Anwar told reporters after the verdict that "justice had been served" with his acquittal, and he has vowed to topple the government in the next elections, which could be held as early as this year.
Anwar has denounced the trial -- his second on sodomy charges in the last 12 years -- as part of an attempt by the government to cripple his opposition movement.
compiled from agency reports