Competition is a major force in structuring ecological communities. The strength of competition can be measured using the concept of a niche. A niche comprises the set of requirements of an organism in terms of habitat, environment and functional role. The more niches overlap, the stronger competition is. The niche breadth is a measure of specialization: the smaller the niche space of an organism, the more specialized the organism is. It follows that, everything else being equal, generalists tend to be more competitive than specialists. In this paper, we compare the outcome of competition among generalists and specialists in a spatial versus a nonspatial habitat in a heterogeneous environment. Generalists can utilize the entire habitat, whereas specialists are restricted to their preferred habitat type. We find that although competitiveness decreases with specialization, specialists are more competitive in a spatial than in a nonspatial habitat as patchiness increases.