We present a detailed derivation and thin interface analysis of a phase-field model that can accurately simulate microstructural pattern formation for low-speed directional solidification of a dilute binary alloy. This advance with respect to previous phase-field models is achieved by the addition of a phenomenological "antitrapping" solute current in the mass conservation relation [A. Karma, Phys. Rev. Lett 87, 115701 (2001)]. This antitrapping current counterbalances the physical, albeit artificially large, solute trapping effect generated when a mesoscopic interface thickness is used to simulate the interface evolution on experimental length and time scales. Furthermore, it provides additional freedom in the model to suppress other spurious effects that scale with this thickness when the diffusivity is unequal in solid and liquid [ R. F. Almgren, SIAM J. Appl. Math 59, 2086 (1999)], which include surface diffusion and a curvature correction to the Stefan condition. This freedom can also be exploited to make the kinetic undercooling of the interface arbitrarily small even for mesoscopic values of both the interface thickness and the phase-field relaxation time, as for the solidification of pure melts [A. Karma and W.-J. Rappel, Phys. Rev. E 53, R3017 (1996)].The performance of the model is demonstrated by calculating accurately for the first time within a phase-field approach the Mullins-Sekerka stability spectrum of a planar interface and nonlinear cellular shapes for realistic alloy parameters and growth conditions. 2