In ingredient terms alone, Spain's tortilla española (also called tortilla de patatas or a Spanish potato omelet), could be called the simplest of comfort foods. After all, it's just olive oil, potatoes, salt, and the freshest possible eggs. As equally essential as high-quality ingredients, though, is treating them right: cutting the potatoes to a careful thickness, leaving the beaten eggs warmed but still runny in the center, and never skimping on the oil. Beyond that, a nonstick pan—and a good teacher—make all the difference.

Served triangulated in tapas bars, tucked into baguettes for simple lunches, or layered with serrano ham for dinner, tortilla is ubiquitous in Spain. Depending on skillet size and how high you pile the potatoes, versions range in thickness from cook to cook, but one aspect of the technique never changes: tortilla is always made entirely on the stovetop, never baked. Because of this, making it requires a skillful inversion of the whole intact omelet from pan to plate and back.

Though that part takes a bit of practice to master, tortilla has never been a precious dish. When the potato first arrived in Europe around 1570, carried across the Atlantic by conquistadors returning from Peru, it was seen as a second-class starch. Europeans much preferred airy croissants and crisp ciabattas to the lowly spud, writes University of Warwick historian Rebecca Earle in her piece "Promoting Potatoes in Eighteenth-Century Europe." But they were forced to change their eating habits after a series of drought-inflicted wheat shortages in the late 18th century. Governments pushed the hardier potato on constituents; in Spain, prizes were offered for the largest potato crop and the most inventive potato dish, Earle explains.

Potatoes in oil.
Don't skimp on oil: Fully submerging all the potatoes and onions in it helps them cook evenly.Julia Scheeres

Nobody knows who cooked the first tortilla de patatas, but texts suggest that the now-famous dish has been on rotation in Spanish households since 1767. While the appeal of the original omelet has always been its simplicity and economy, in recent years, chefs have taken some extreme liberties with the basic recipe, to mixed results—I've found one that cost 837 euros thanks to potatoes from Normandy and a rare olive oil, and another "deconstructed" into a blended smoothie. But for centuries before, it was a survival food that sustained Spaniards during droughts, wars, and private penuries.

Tortilla was certainly survival food for me when I moved to Spain at 22. I landed in Valencia during a severe recession and barely scraped by as an under-employed English tutor. My then-boyfriend was a slouch (who rarely cooked), but he did teach me to make tortilla standing over the stove, chipping a peeled potato straight into a pan of sputtering oil. Back then, I had a knack for overcooking the eggs, leaving them more insipid and dry than desirable, and for a while tortilla seemed a physical manifestation of my inability to thrive—financially or romantically—in Spain.

This month, more than two decades after that sojourn, I returned to Spain with my (non-slouch) husband, and made time to master the dish. At Barcelona Cooking on Las Ramblas, I learned the tricks to achieve spectacular results: a tortilla with a golden exterior and a custard-like interior, with the fruity flavor of olive oil coming through in each bite.

Back in our understocked rental kitchen the morning after our lessons, I was a little anxious to try the technique on my own. The house only carried a too-large pan, for starters. But even though my tortilla turned out a bit misshapen as a result, I achieved that deliciously runny interior and edges that set properly and were tucked neatly around the tender potatoes. I ate our tortilla triumphantly, looking out our window over Barcelona, our dish as golden and beautiful as the yellow flowers of the jacaranda trees that filled the plaza outside.

Here’s how to make tortilla española like the Spaniards do.

Optimize Your Ingredients

When you're cooking any four-ingredient dish, choosing ingredients with optimal flavor will go a long way. Joan Antoni Miró, chef-owner of Les Truites ("the omelets" in Catalan), a Barcelona restaurant that serves 200 types of tortillas, recommends Kennebec—a low-starch white potato that holds its shape well after cooking. He counsels against using new potatoes for this dish: older potatoes are drier and release less liquid. The restaurant uses locally sourced sweet Figueres onions, but in the U.S., Vidalias are a good substitute.

Poach, Don't Fry the Potatoes

This tip made all the difference for me—simmering the potatoes and onion in a scandalous amount of olive oil, so the vegetables become soft, malleable, and imbued with flavor. Don't skimp; submerging the potatoes in oil also helps them cook evenly. "Add the potatoes when the oil is barely warm," instructs Spanish food blogger María Isabel Fraga Blanco of La Cocina de Frabisa. "If you note that the potatoes are turning golden brown, lower the flame." Reserve any remaining oil for future use.

Have Faith in the Flip

This is the hardest skill for beginners to master. When the bottom and edges of the tortilla are set (the top will be wet), it’s time for the flip. To do it, carefully run a spatula around the edges of the set egg to loosen it. Overturn a plate on top—Miró suggests using a plate that is slightly smaller than your skillet, so that the surface and edges can come right up against the surface of the egg. Wrap your wrist in a kitchen towel to protect it from the hot oil. Then quickly and confidently invert the mixture onto the plate. Carefully slide the tortilla back into the hot skillet, so that the less-cooked side is now touching the surface of the pan. Return to the heat and finish cooking just until runny, gently tucking the edges tightly around it and beneath it with the spatula to give the finished dish a tidy, rounded shape.

Nail the Texture

Spanish tortilla on white plate.
In Spain, a perfect tortilla has a fully set exterior and lightly runny interior.Julia Scheeres

Most Spanish home cooks enjoy their tortillas warmed through but still runny, custardy, and jiggly in the center, then set and lightly browned on the exterior. (You might notice tortillas displayed under or behind glass cases in tapas bars are sometimes cooked more because of salmonella fears, says Lalo Beltran, a chef at Barcelona Cooking.) To test yours for doneness before you remove it to a plate, press a finger against the center of the tortilla to measure the amount of give—you want it to be soft and tender but not fully soupy. Remember, the eggs will continue to cook slightly after you remove the pan from the heat. Slide it out onto a plate, always presenting tortilla with the first side you seared facing up.