A simple surface-reaction model based upon the oxidation of carbon monoxide on a catalytic surface, introduced by Ziff, Gulari, and Barshad (ZGB) [Phys. Rev. Lett. 56, 2553 (1986)], has been extended in order to include diffusion of the adsorbed particles (both O and CO). The ZGB model is a nonequilibrium model exhibiting both a first- and a second-order phase transition. The effects of diffusion on the behavior of the model has been explored by means of computer simulations. The main effect of diffusion is to change the positions of the phase transitions and increase the rate of CO2 formation. Fast diffusion causes the second-order transition to disappear from the system. Simple explanations of these changes are given. The extended version of the ZGB model has furthermore been studied by mean-field theory in the pair approximation. This approach gives qualitatively correct predictions about the effects of diffusion and yields quantitative predictions in good agreement with simulation results in the vicinity of the first-order transition.