Highly pathogenic avian influenza virus H5N1 is endemic in poultry in East and Southeast Asia with disease outbreaks recently spreading to parts of central Asia, Europe and Africa. Continued interspecies transmission to humans has been reported in Vietnam, Thailand, Cambodia, Indonesia and China, causing pandemic concern. Here, we genetically characterize 82 H5N1 viruses isolated from poultry throughout Indonesia and Vietnam and 11 human isolates from southern Vietnam together with sequence data available in public databases to address questions relevant to virus introduction, endemicity and evolution. Phylogenetic analysis shows that all viruses from Indonesia form a distinct sublineage of H5N1 genotype Z viruses suggesting this outbreak likely originated from a single introduction that spread throughout the country during the past two years. Continued virus activities in Indonesia were attributed to transmission via poultry movement within the country rather than through repeated introductions by bird migration. Within Indonesia and Vietnam, H5N1 viruses have evolved over time into geographically distinct groups within each country. Molecular analysis of the H5N1 genotype Z genome shows that only the M2 and PB1-F2 genes were under positive selection, suggesting that these genes might be involved in adaptation of this virus to new hosts following interspecies transmission. At the amino acid level 12 residues were under positive selection in those genotype Z viruses, in the HA and PB1-F2 proteins. Some of these residues were more frequently observed in human isolates than in avian isolates and are related to viral antigenicity and receptor binding. Our study provides insight into the ongoing evolution of H5N1 influenza viruses that are transmitting in diverse avian species and at the interface between avian and human hosts.