Can the nitrogen of an amide displace a primary chloride in a SN2 reaction in the presence of a strong base? I was looking at the following reaction and am confused.



It appears that $\ce{N}$ is attacking the $\ce{C-Cl}$ and $\ce{Cl}$ is leaving in a $\mathrm{S_N2}$ reaction. I know that $\ce{Cl}$ is a good leaving group, but $\ce{N}$ isn't a particularly soft nucleophile so I wouldn't expect it to be great at attacking a saturated carbon.

Additionaly there is $\ce{MeO-}$ in solution, even with intramolecular cyclisation being quick wouldn't there be a realitive amount of attack by $\ce{MeO-}$.

So am I missing something? Is this not as simple an $\mathrm{S_N2}$ as I have made out? 
Why is sodium methoxide ($\ce{NaOMe}$) a good choice of base?
Well it is difficult to compare an intra-molecular reaction with an extra-molecular one because it really depends on the conditions. However, unless you have a very high concentration of one reactant, the intramolecular way will always be favored.

In your question, you consider that "N" is not a very good "attacking group". Well this is wrong. "N" is always happy to attack any nucleophilic group, even if it becomes "N+". However, a "CON-" is much more nucleophilic than just "CONH".

Sodium methoxide here just serves at deprotonating CONH to activate it, but MeONa (sodium methoxide) is not nucleophilic enough to interfere.