Although use of a nitrogen-containing compound as a basic compound component of a resist composition makes it possible to ease the T-top problem at an acid dissociation constant pKa falling within a range of 2 to 6, it is accompanied with the problem that the reaction, that is, acid diffusion upon use of a highly-reactive acid-labile group cannot be controlled. In order to overcome this problem, one or more basic compounds selected from those represented by the following formulas (I) to (III) and (1) to (4) are employed.