Phosphorus modification is a widely adopted strategy for modulating the performance of ZSM-5 catalysts in methanol-to-hydrocarbon (MTH) reactions. However, the underlying modification mechanism for the structure-performance relationship is not yet fully understood. In this study, a series of phosphorus-modified ZSM-5 (P-ZSM-5) catalysts were synthesized via direct impregnation using ammonium phosphate dibasic as the phosphorus source. With this synthetic method, the aluminum content and structural properties of zeolite are preserved. Our findings showed that phosphorus loading significantly alters the acidity and microporous properties of ZSM-5. To explore the underlying reasons for these changes, we employed 31P and 27Al solid-state magic angle spining (MAS) nuclear magnetic resonance (NMR), which provided chemical and structural insights. The lower amount of strong acid sites resulted in a prolonged lifetime in the MTH reaction and enhanced selectivity toward alkenes for P-ZSM-5. Additionally, the pore narrowing created by adding phosphorus had an additional effect on product selectivity by suppressing o-xylene yields. By using the 13C, 13C-13C, and 1H-13C MAS NMR analysis conducted on the 13C-methanol-reacted catalysts, we demonstrated direct evidence that P-ZSM-5 preserved the same MTH pathways but suppressed the formation of one of the key coke precursors, the 1,2,3-trimethylcyclopentenyl cation. This was further confirmed by the operando UV-vis results, along with the reduced accumulation rate of other coke precursors such as naphthalene and polyaromatics.