On a fiery hot day in late June, tourists filled the cafes and hotel rooms along Spain’s Mediterranean coast, including in Torrevieja, a small city of tightly stacked apartment blocks running along a curved beach.

The seasonal population surge in this dry, sun-baked region might strain water resources were it not for a set of buildings overlooking a pink-tinged lagoon nearby.

These low-slung structures house a vast network of pipes, pumps and tanks in a plant that performs a kind of alchemy crucial to the economy of this part of Spain: drawing huge volumes of water from the sea, removing the salt and creating more than 60 million gallons of fresh water a day.

Acciona, a Spanish company that built the plant, says the facility can supply water for 1.6 million people through the process known as desalination. For much of the year, though, the output is largely used to nurture oranges, lemons and other crops for consumers in Northern Europe.

But when the crowds of tourists arrive in the summer, more water is diverted into the city’s pipes for showering and other domestic use, said Ana Boix, the deputy manager of the plant. “We have a very high-quality water from a source of supply that is endless,” she said.

The Torrevieja plant is the largest of its kind in Europe, and similar plants dot the Spanish coastline. They have helped to enable rampant coastal development in parched areas and to support an agricultural industry that is considered among the world’s most proficient at managing water.