The Latvian HIV-1 outbreak among intravenous drug users (IDUs) in 1997-1998 involved subtype A1. To obtain a more complete picture of the Latvian HIV-1 epidemic, 315 HIV-1-infected patients diagnosed in 1990-2005 representing different transmission groups and geographic regions were phylogenetically characterized using env V3 and gag p17 sequences. Subtypes A1 and B infections were found in 76% and 22% of the patients, respectively. The subtype A1 sequences formed one large cluster, which also included sequences from other parts of the former Soviet Union (FSU), whereas most subtype B sequences formed three distinct clusters. We estimated that subtype A1 was introduced from FSU around 1997 and initially spread explosively among IDUs in Riga. A recent increase of heterosexually infected persons did not form a separate subepidemic, but had multiple interactions with the IDU epidemic. Subtype B was introduced before the collapse of the Soviet Union and primarily has spread among men who have sex with men.