The aim of this cross-sectional study was to evaluate the primary determinants of knowledge and attitudes regarding pain among nurses in a hospital setting. All registered nurses employed at participating units at a university hospital were invited to participate. Information on work experience, education, and hospital unit was evaluated using a questionnaire. The Knowledge and Attitude Survey Regarding Pain instrument was used to assess knowledge on pain management. The difference in knowledge between nurses with different levels of education was assessed with analysis of variance. The discriminatory ability of each question was determined with item response theory, and the association between correct answers to individual items and the total score were calculated using linear regression. Participants were 235 nurses, 51% of the 459 invited. The overall pain knowledge score was 26.1 (standard deviation 5.3, range 8–38) out of a total of 40 possible. Those with an advanced degree in nursing scored on average 2.9 points higher than those who did not have an advance degree (95% confidence interval: 0.9–4.7). Responses to clinical vignette questions showed more difference between nurses with different levels of knowledge of pain management than the other questions. Participants with the correct response to the best discriminatory item had 5.35 (95% confidence interval 4.08–6.61) points higher total score than those with an incorrect answer. Higher education is associated with better knowledge on pain management. To assess pain knowledge, the ability to interpret and solve a clinical vignette leads to better results than answering direct questions.