Control of polymer morphology and chain orientation is of great importance in organic solar cells and field effect transistors (OFETs). Here we report the use of nanoimprint lithography to fabricate large-area, high-density, and ordered nanostructures in conjugated polymer poly(3-hexylthiophene) or P3HT, and also to simultaneously control 3D chain alignment within these P3HT nanostructures. Out-of-plane and in-plane grazing incident X-ray diffraction were used to determine the chain orientation in the imprinted P3HT nanostructures, which shows a strong dependence on their geometry (gratings or pillars). Vertical chain alignment was observed in both nanogratings and nanopillars, indicating strong potential to improve charge transport and optical properties for solar cells in comparison to bulk heterojunction structure. For P3HT nanogratings, pi-pi stacking along the grating direction with an angular distribution of +/-20 degrees was found, which is favorable for OFETs. We propose the chain alignment is induced by the nanoconfinement during nanoimprinting via pi-pi interaction and hydrophobic interaction between polymer chain and mold surfaces.