Pat the drained chickpeas dry with a paper towel — this is key for getting crispy edges.
Heat olive oil in a skillet over medium-high heat. Add the diced onion and cook for 2 minutes.
Add the chickpeas in a single layer. Cook without stirring for 2–3 minutes until the bottoms begin to brown and crisp.
Stir, then add the minced garlic, cumin, smoked paprika, turmeric, salt, pepper, and chili flakes. Toss to coat everything and cook for another 1–2 minutes.
Add the spinach on top and stir until it wilts completely, about 1–2 minutes. If using frozen spinach, stir in and heat through.
Taste and adjust seasoning. Push the chickpea mixture to the sides of the pan, creating two small wells in the center.
Crack one egg into each well. Reduce heat to medium-low, cover the pan, and cook for 2–3 minutes until the whites are set but the yolks are still slightly runny.
Remove from heat. Squeeze lemon juice over the top if using. Serve directly from the pan with yogurt on the side.