Cut the potatoes into thin slices, about ¼-inch thick or, if you can manage it, even thinner. Use a mandoline slicer for best results.
Do the same with the onions.
Heat the olive oil in a frying pan. Over medium heat, fry the potato slices. Stir them around gently to make sure that no slices are sticking together.
Add the onion slices to the potatoes. Continue frying until the potatoes are cooked through and the onion slices have softened.
Strain the potato and onion slices.
Pour the oil off the frying pan (you may reuse it) leaving only enough to coat the bottom lightly.
Beat the eggs with salt and pepper in a mixing bowl. I use a generous pinch of salt and a small pinch of pepper for every egg.
Add the potato and onion slices to the beaten eggs. Stir them gently to allow the beaten eggs to seep between them.
Reheat the cooking oil in the frying pan. Pour in the egg, potato and onion mixture. Set the heat to low. Cover the pan. Allow the tortilla to cook for about ten minutes.
Loosen the sides and bottom of the tortilla with a spatula. Check if the sides and bottom have browned nicely. At this point, the eggs will still be a little raw at the center but the sides should be firm.
Place a plate (should be wider than the pan), upside down, on top of the pan. Pressing down on the plate with one hand and holding the pan with the other, invert the tortilla on the plate.
Drizzle more olive oil to coat the bottom of the pan. Reheat. Slide the tortilla back into the pan, cover and cook for another five minutes.
Cool the Spanish tortilla a little before slicing.