The formation of new species within the same geographic area through ecological specialization is called sympatric speciation.
In sympatric speciation, populations remain in the same broad region rather than being separated by a physical barrier. Reproductive isolation develops because individuals begin using different resources, habitats, behaviors, or mating signals. Over time, reduced gene flow allows the diverging groups to accumulate enough genetic differences to become separate species.
A classic example involves apple maggot flies, Rhagoletis pomonella. Some flies specialize on hawthorn fruit, while others use introduced apples. Flies tend to mate on the host plant where they developed, so ecological preference can gradually create assortative mating within the same area. Whether every proposed example fully qualifies remains debated, because complete reproductive isolation can be difficult to demonstrate.
Sympatric speciation is distinct from allopatric speciation, where a geographic barrier separates populations. Parapatric speciation involves neighboring populations with limited contact, while adaptive radiation describes the diversification of one lineage into multiple ecological forms and is not itself a geographic mode of speciation. In plants, chromosome doubling, or polyploidy, can produce reproductive isolation especially rapidly.