What tastes great in a margarita, can be either smoky or smooth, and may hold the key to how plants of the future will survive global warming? You might not have known the last one, but the first two give it away, right? It’s Agave. We’re talking about agave.

That’s right. The Mexican cactus-like plant most known for being distilled into tequila and mezcal has climate change resistant genes, a team of researchers from the Department of Energy’s Oak Ridge National Laboratory and Newcastle University in England recently published in the journal Nature Plants.

“If we can harness these genes and engineer new drought-resistant plants then the potential is huge in terms of developing crops and biofuels that are able to withstand the challenges we face from a changing climate,” professor Anne Borland, the lead research from Newcastle University, said in a statement obtained by ZME Science.

The gene controls the stomata in the agave plant, which are the pores the plant uses to breathe. Agave stomata open at night and close during the day, which is the opposite of your run-of-the-mill greenery. Night time openings mean less carbon dioxide is absorbed and photosynthesis is less efficient, but the plant retains more water than it would if it opened its stomata under the hot sun.

To understand why, you have to consider the different types of photosynthesis that plants use. Agave photosynthesis is known as CAM, which is the best for water efficiency. Then there’s C4 photosynthesis, which is faster in high light and heat. Finally there’s C3, the most common type of photosynthesis, which is very efficient in normal, non-global warming conditions, but loses water faster than any other when it starts to get too hot out.

Plants that use CAM photosynthesis and those that use C3 aren’t all that different, though. It all depends on how the genes are expressed.

“Because both plant types have a similar genetic makeup, we are hopeful that it will be possible to turn C3 plants into CAM plants simply by finding the right triggers,” Borland said. “This is a really exciting discovery and a major breakthrough in our quest to create new plants that can cope in our future environment.”

The most opportunity is with crops like rice, corn, poplar, and switchgrass. Changing the photosynthesis type in these plants would reduce the competition for water for other food crops.

There you have it. Agave is not only going to save your night, it’s going to save other species of plants after humans watch the world burn. Round of tequila shots, anyone?