Analysis of within-patient HIV evolution under anti-HIV therapy is crucial to a better understanding the possible mechanisms of HIV drug-resistance acquisition. The high evolutionary rate of HIV allows us to trace its evolutionary process in real time by analyzing virus samples serially collected from the same patient. However, such studies are still uncommon due to the lack of powerful computational methods designed for serial virus samples. In this study, we develop a computational method, vSPA (viral Sequential Pathway Analysis), which groups viral sequences from the same sampling time into clusters and traces the evolution between clusters over sampling times. The method makes use of information of different sampling times and traces the evolution of important amino acid mutations. Second, a permutation test at the codon level is conducted to determine the threshold of the correlation coefficient for clustering viral quasispecies. We applied vSPA to four large data sets of HIV-1 protease and reverse transcriptase genes serially collected from two AIDS patients undergoing anti-HIV therapy over several years.