The sunlight angles though towering windows into a “cathedral” unlike any other, illuminating a dirt floor lined with thousands of sherry wine barrels stacked inside Bodega Barbadillo. Forty-foot columns rise to arches running the length of a football field, culminating in a massive rose window at the south end.

Though locals use the language of Christianity to describe the space, it’s no church. The designation is as much a reflection of the cellar’s design as it is the region’s near-religious devotion to the minerally, dry fortified wines produced in this corner of southwestern Spain. They even refer to the tasting room as the sacristy.

As we wind past the barrels, out the building and into a former convent taken over by the winery, the ceilings get shorter, the air more acidic. It’s here that the wine is turned into vinegar, and the culinary connection to spirituality gets all the more curious.

“For us, there are some dishes in Andalusian cuisine that have no soul without this vinegar,” says José Ferrer Morató, the “ambassador” for sherry’s regulating body, as we sample woodsy, mahogany vinegars so old, their true age is unknown. Surely, I insist, there must be some clue of the age. “This is old, really old, decades,” says our guide, Armando Guerra. “With sherry, mathematics have less importance than poetry.”

And here I’d thought it was just vinegar. But as I would learn over a week of eating through the Jerez de la Frontera area, this isn’t any vinegar. It’s as complex as the wines themselves, a bright, woodsy condiment revered as if magical. One that takes a starring role as a finishing splash for roasted vegetables. Or doubles down on its brightly complex flavor to transform a homey beef stew so good I would eat it four times in two days.

Clearly, this isn’t just any vinegar.

Any exploration of the food here must pass through the sherry trail, a triangle of towns where wine has been made since the Phoenicians planted vines some 3,000 years ago. Early on, sherry had a reputation for traveling well, thanks to the distilled grape liquor added to raise its alcohol content high enough to deter bacterial growth during long, hot summers. It became so popular in medieval England that Shakespeare referenced it in at least six plays.

These days, it’s an incredibly complex category of wines, ranging from straw-colored to amber. Most are made from the same white palomino grape, and all are aged in an elaborate system of mixing different barrels that can go on for decades. None resemble the domestic cream sherries your grandmother may have sipped, and forget about “cooking sherry.” It belongs in the trash.

Instead, most “vinos de Jerez” are bracing, aromatic wines perfect for sipping on a sweltering summer day—or for deglazing a pan to brighten a sauce or add oomph to a braising liquid. They’re also unfussy, poured into glasses at tapas bars for as little as $2 a pop.

Sherry vinegar, for its part, was historically made as a preservative cheaper than salt, but it evolved. “It’s such a big part of the cuisine because the vinegar used to be needed to conserve food,” Ferrer says in the seaside village of Sanlucar de Berramenda, a point on the sherry triangle known for crisp, light manzanilla. “Now with refrigeration, we don’t need to conserve, but we developed a taste for vinegar.”

He leads me down the hill from Barbadillo, and we see this predilection everywhere: Charred peppers and sweet shrimp swimming in tangy dressing. Poached mackerel on brightly seasoned crushed potatoes. Stuffed baby octopus. A mixed seafood and onion salad known as salpicón. Partridge “en escabeche,” or its own pickling liquid.

In each plate, “the vinegar is the protagonist,” says Ferrer. A bright punch of flavor that cleanses the palate with each bite. But not all sherry vinegars are created equal. Some tapas lend themselves to the fresher acidity of pale, young vinegar, while the tang of others comes with the caramel, woodsy notes produced through years of aging in oak barrels.

Its unique flavor springs from an equally unique process, one that’s on display at the El Majuelo vinegar bodega in nearby Jerez de la Frontera. Five hundred-liter American oak barrels of vinegar are stacked in pyramids four rows high, aging according to the same “solera” system as the wines themselves. In each case, the bottom row is the oldest, from which all vinegars and wines are bottled. Only about a third of the liquid is ever removed from each barrel, which is replenished from the row above, which is replaced by newer wine or vinegar, and so on for up to nine different stages of mixing.

“In Italy, in France, wherever there’s wine, there’s vinegar,” says Joaquín Gómez Beser, the fifth generation to run El Majuelo. “But the difference with ours is that the raw material is sherry wine, which is totally different than any wine in the world.”

“For us, there are some dishes in Andalusian cuisine that have no soul without this vinegar.” —José Ferrer Morató

El Majuelo’s “young” vinegar is aged at least a year, the reserva for at least five, and the gran reserva a minimum of 10. But the real age of any vinegar is surely older, since the old is always being mixed with the new.

Gómez sets up a row of wine glasses to taste different vintages. He dips a cup attached to a long stick into a barrel to pour the vinegars, then dilutes each with water to let the aromas emerge. Notes of walnuts and dried fruit mark the youngest. Then come caramel, wood and vanilla. For the gran reserva, chocolate, tobacco and leather.

It’s easy to imagine these in vinaigrettes for salads with bold ingredients like blue cheese, walnuts and bitter greens. But Gómez says they also are great for pickling vegetables, macerating strawberries, drizzling on poached eggs or sautéed mushrooms, or punching up the flavor of subpar tomatoes. And no family in the area makes legumes, particularly lentils, without a finishing splash of aromatic vinegar to balance the starchy richness.

Yet it’s so much more than a condiment, and many cooks add it in stages. A couple tablespoons added early to a braise diminishes the vinegar’s acidity while retaining its woodsy, caramel complexity; another couple tablespoons stirred in at the end offsets the richness of otherwise heavy stews.

There is one guiding principle: The older the vinegar, the less you need, says chef Israel Ramos. He trained in some of the top kitchens around Spain before returning to Jerez to specialize in plates rooted in the traditional cuisine of the area, but updated.

His beef stew, or guiso de ternera, is my first to try—and sets a high bar. In the kitchen of his restaurant, Mantúa, it comes together in a familiar way. Brown the meat and remove, cook the garlic and onion, then the carrot with bay and sweet paprika, deglaze the pan with wine. Add the meat back with beef stock and simmer.

Several touches, however, make it unlike any other. The addition of nutmeg—other cooks also add cinnamon—recalls the legacy of the spice-­loving Moors who ruled this area for more than 500 years. Deglazing the pot with dry fino sherry, which is quite similar to manzanilla, adds its own acerbic minerality. And of course, rich gran reserva vinegar, added first with the stock, complements the barely detectable sweetness of nutmeg and caramelized onions.

As the stew simmers, Ramos sends out modern interpretations of tomato salad, poached sea bass, and rabbit with pickled onion, a roller coaster of flavors tinged with vinegars Ramos had made from beets, carrots and even serrano ham. But a highlight is the stew, a purely traditional recipe passed down over centuries and expertly relayed. Brothy but rich, with tender, fall-apart beef, a hint of sweet from nutmeg and a fresh tang from a final splash of vinegar. It’s easily the best of the four I would taste, if not the best beef stew I’d ever had.

Only a couple tablespoons are needed of the potent ingredient to transform it from good to great. “If it’s your first time with it, add it little by little,” Ramos says. “But at the end, sherry vinegar is going to get you hooked. For cooking, it’s magical.”