Electrospun polyimide (PI) nanofibers with excellent mechanical and thermal properties are highly required in composites, filtration, battery separators, proton exchange membranes, dielectric materials, oil-water separation, and functional sponges, because of their high mechanical strength, high porosity, good chemical and heat-resistance. In this work, a ternary polyamic acid composite precursor was used to achieve this aim. The resultant ternary PI aligned electrospun composite nanofibers (PI-AENFs) were composed of rigid moiety, soft moiety and pyrimidine-containing moiety. When the molar ratio was 40/36/24, the ternary composite PI-AENFs showed a highest tensile strength of 962 MPa, and a high modulus of 9.17 GPa. Because of the existence pyrimidine rings, the ternary composite PI-AENFs showed a 5% and 10% weight loss temperatures in the range of 537-551 degrees C and 577-583 degrees C, respectively. In addition, dynamic mechanical analysis indicated that the ternary composite PI-AENFs possessed good compatibility with each moiety because of the only one peak in the range of 294-333 degrees C in the dynamic mechanical analysis curves, suggesting a high glass transition temperature for all the ternary composite PI-AENF samples. These PI-AENFs with outstanding mechanical and thermal properties will provide good opportunity for applications in the high-temperature fields, such as filtration, fiber reinforced composites, battery, and so on.