Background: Viral replication within the central nervous system (CNS) facilitates neurological complications and reflects a potentially important tissue reservoir. The timing of emergence and character of this local CNS replication is unknown. We examined phylogenetic relationships and viral characteristics of paired cerebrospinal fluid (CSF) and blood samples obtained over the first two years of HIV infection. Methodology: Subjects with primary HIV infection (PHI, <1 year after initial infection) were enrolled in San Francisco, USA, in a longitudinal neurological study including serial paired CSF and blood sampling. Using single genome amplification (SGA) and phylogenetic analysis of the full-length env gene, we compared viral populations from blood and CSF in samples obtained up to two years post-infection from 72 ART-naive PHI subjects infected with HIV-1 subtype B. Results: At baseline, subjects were a median 106 (IQR 73, 158) days post infection, had 567 (411, 732) CD4 T cells/ul, 4.66 (4.09, 5.08) plasma HIV RNA log10 copies/ml, and 2.62 (1.74, 3.32) CSF HIV RNA log10 copies/ml. Independent replication in the CNS (compartmentalization) was detected in 12% of all sample pairs, predominantly after four months of infection. Approximately 20% of the time there was either compartmentalization or marked pleocytosis, which we propose are dynamic and interrelated. Longitudinal assessment of individual subjects demonstrated that compartmentalized replication was present either as a transient state, or was maintained within the CSF and diversified independently over a period of time during early infection. Two subjects had one of two transmitted lineages (or their recombinant) largely sequestered within the CNS shortly after transmission, indicating a second mechanism for establishing independent replication in the CNS early. All viruses examined required high levels of CD4 for entry, indicative of replication in CD4+ T cells. Conclusions: Examination of the relationships between CSF viral populations, blood and CSF viral loads, and inflammatory responses identified four distinct states of viral population dynamics, and revealed putative mechanisms of local viral replication and the early influx of virus into the CNS. We observed genetically complex, compartmentalized viral replication within the CSF/CNS suggestive of sustained replication in CD4+ T cells during the first two years of HIV infection.