Stroke is a major public health problem leading to high rates of death and disability in adults. Excessive stimulation of N-methyl-D-aspartate receptors (NMDARs) and the resulting neuronal nitric oxide synthase (nNOS) activation are crucial for neuronal injury after stroke insult. However, directly inhibiting NMDARs or nNOS can cause severe side effects because they have key physiological functions in the CNS. Here we show that cerebral ischemia induces the interaction of nNOS with postsynaptic density protein-95 (PSD-95). Disrupting nNOS-PSD-95 interaction via overexpressing the N-terminal amino acid residues 1-133 of nNOS (nNOS-N(1-133)) prevented glutamate-induced excitotoxicity and cerebral ischemic damage. Given the mechanism of nNOS-PSD-95 interaction, we developed a series of compounds and discovered a small-molecular inhibitor of the nNOS-PSD-95 interaction, ZL006. This drug blocked the ischemia-induced nNOS-PSD-95 association selectively, had potent neuroprotective activity in vitro and ameliorated focal cerebral ischemic damage in mice and rats subjected to middle cerebral artery occlusion (MCAO) and reperfusion. Moreover, it readily crossed the blood-brain barrier, did not inhibit NMDAR function, catalytic activity of nNOS or spatial memory, and had no effect on aggressive behaviors. Thus, this new drug may serve as a treatment for stroke, perhaps without major side effects.