In this paper, a generalized lattice Boltzmann (LB) model with a mass source is proposed to solve both incompressible and nearly incompressible Navier-Stokes (N-S) equations. This model can be used to deal with single-phase and twophase flows problems with a mass source term. From this generalized model, we can not only get some existing models, but also derive new models. Moreover, for the incompressible model derived, a modified pressure scheme is introduced to calculate the pressure, and then to ensure the accuracy of the model. In this work, we will focus on a two-phase flow system, and in the frame work of our generalized LB model, a new phase-field-based LB model is developed for incompressible and quasi-incompressible two-phase flows. A series of numerical simulations of some classic physical problems, including a spinodal decomposition, a static droplet, a layered Poiseuille flow, and a bubble rising flow under buoyancy, are performed to validate the developed model. Besides, some comparisons with previous quasi-incompressible and incompressible LB models are also carried out, and the results show that the present model is accurate in the study of two-phase flows. Finally, we also conduct a comparison between quasiincompressible and incompressible LB models for two-phase flow problems, and find that in some cases, the proposed quasi-incompressible LB model performs better than incompressible LB models.Keywords: generalized lattice Boltzmann model, mass source term, incompressible and nearly incompressible N-S equations, fluid flow system, two-phase flow