It is not related to mesquites, which are legumes. "Neobarrettia spinosa" inhabits in Oak-juniper woodlands and arid-land deserts with mesquites or other brushes. Generally, pinyons, mesquites and oaks factor into this usage. The larva feed on "Fabaceae", particularly mesquites ("Prosopis" species). In the desert it sometimes grows beneath mesquites where it thrives in the local nutrients. Mesquites rapidly accumulate windblown sand, forming nabkhas. Near waterways, mesquites can form deciduous woodlands called bosques. Mesquites grew more densely and spread into what had been grassland. As a member of the legume family, mesquites fix nitrogen in the soil. Mesquites can serve as nurse trees to young cacti, such as the saguaro.